private void getButton_Click(object sender, EventArgs e) { DataGridViewSelectedRowCollection sel = grid.SelectedRows; if (sel == null || sel.Count == 0) { if (MessageBox.Show("Do you want an allocation for every group?", "No selection", MessageBoxButtons.YesNo) == DialogResult.No) { MessageBox.Show("Then you must first select the group(s) you want."); return; } // Go through each group, getting an allocation for each one // ... even if it already has one? m_IdMan.GetAllocation(); } else { foreach (DataGridViewRow row in sel) { IdGroup g = (IdGroup)row.Cells["dgcGroupName"].Value; g.GetAllocation(false); // no announcement } } RefreshList(); SetChanged(); }