how loop through multiple checkbox in C#
I have 100 checkbox in a winfrom. Their name is sequential like
checkbox1,checkbox2 etc. I have a submit button in my winform. After
clicking the submitting button, it checks, if a checkbox is checked then
some value is updated otherwise another value is updated. I have to check
100 checkbox. So i have to loop through the 100 checkbox to check if the
checkbox is checked or not.
I know how to check the checkbox
private void sumit_button_Click(object sender, EventArgs e)
{
if (checkbox1.Checked)
{
// update
}
else
{
// update another
}
if (checkbox2.Checked)
{
// update
}
else
{
// update another
}
......................and so on
}
But how can i do this for 100 checkbox???
No comments:
Post a Comment