I have a DataGridView with CheckBox, now my question is how do I set a limit on how many CheckBox can be checked into say like 3? I already have the code for counting how many CheckBox is checked. I am new to programming and sorry for my bad english.
private void DataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
bool isChecked = Convert.ToBoolean(DataGridView1.Rows[DataGridView1.CurrentCell.RowIndex].Cells[0].Value.ToString());
if (isChecked)
{
num += 1;
}
else
{
num -= 1;
}
MessageBox.Show(num.ToString());
}
Aucun commentaire:
Enregistrer un commentaire