I have datagridview column with checkboxes. I want to check if there is a selected Row in this column. If its not I want to display msgbox. I can check columns by this but i'm receiving multiple msgboxes for every unchecked row. How to change it to receive only one msgbox?
Thanks
foreach (DataGridViewRow row in dataGridView1.Rows)
{
DataGridViewCheckBoxCell cell = row.Cells[5] as DataGridViewCheckBoxCell;
//We don't want a null exception!
if (cell.Value == null)
{
MessageBox.Show("Nie zaznaczono pola!");
}
}
Aucun commentaire:
Enregistrer un commentaire