I am creating a five checkboxes dynamiclly with a for loop inside a GroupBox. now, they were created dynamiclly, so I don't know how can I make a ChangeCheck method attached to them?
All those checkoxes are related so what I am trying to do is something like that:
- create 5 checkboxes dynamiclly
- add each checkbox to a list
- when a specific checkbox in the list is on trigger a method.
this is how I create the checkboxes:
for (int i = 0; i < 5; i++)
{
CheckBox chk = new CheckBox();
chk.size = new Size(10, 10);
chk.Top = 10
chk.Left = 20
chk.Text = i.ToString();
group_box_name.controls.Add(chk);
}
Now, how can I detect which checkbox was on/off?
Aucun commentaire:
Enregistrer un commentaire