foreach (DataGridViewRow row in datagridviews.Rows) { currQty += row.Cells["qty"].Value; //More code here }