Loop through number of CheckBoxes

Jun 14 2011 5:54 AM
Hi!

I'm coding an alarmserver where I have 5(colls) x X(rows) of CheckBoxes; like this

X        X        X        X        X
X        X        X        X        X
...

These boxes gets Checked in runtime, which meens that I have to see if any box is Checked continously.

So far I've made a code that creates a List when the page Alarms is opened, where all CheckBox items are added to the list.

        void Alarminnstillinger_Opened(System.Object sender, System.EventArgs e)
        {
            // Oppretter liste for å holde på alle CheckBox'er
            List<CheckBox> s = new List<CheckBox>();
            // Legger 100 CheckBox'er i List
            for(int i = 1; i <=100; i++)
            {
                s.Add(CheckBox(i));
            }
           
        }


This code is inside a function Alarminnstillinger_Opened, how can I use s.CheckedChanged outside this function so that when the user checks a CheckBox a function is called?

Answers (2)