QuestionHelpforthis instead of foreach

Posts 1–2 of 2 · Page 1 of 1
forthis instead of foreach
hi

jorndel already gave me this code:

Code:
 foreach (Control C in this.Controls)
            {
                if (C is CheckBox)
                {
                    CheckBox CheckBoxC = C as CheckBox;
                    if (CheckBoxC.Checked)
                    {
                        int Che = int.Parse(CheckBoxC.Name.Replace("checkBox", ""));
                    }
                 }
             }
but this was to overrun all checkboxes in the form, can i do something like forthis (Control C in this.Controls) ?
so i just have the value of the checkbox i just changed (i don't mind to manualy add an integer if nescecary

thx
MSDN Library
Find your answer here... Its the wiki of microsoft's programming langs.
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us