Is there any possible to access to the CheckedChanged Event to handle all checkboxes, when they are changed?
private void AddTask(int member, String bound)
// ...
for (int i = 1; i <= bound; i++) {
CheckBox checkBox = new CheckBox();
checkBox.Name = String.Format("c_Mem{0}_A{1}", member, i);
checkBox.Text = "";
checkBox.Width = 20;
checkBox.Height = 15;
checkBox.Location = new Point(boundX_ChkBox, boundY_ChkBox);
boundX_ChkBox += 26;
//...
}
}
I tested following, which doesnt worked for me. (I just tried to check for one checkbox, which should be actually later in a loop)
private void checkBox_CheckedChanged(object sender, EventArgs e)
{
if ((CheckBox)this.Controls["c_Mem1_A1"]).Checked)
{
MessageBox.Show("Test");
}
}
Aucun commentaire:
Enregistrer un commentaire