int i = 0; while (i < datagrid.Rows.Count) { datagrid[2, i].Value = (Convert.ToInt32(datagrid[0, i].Value.ToString()) + Convert.ToInt32(datagrid[1, i].Value.ToString())).ToString(); i++; }