Skip to content

Loop through number of CheckBoxes

Bjorn Idar Kristiansen

Asked Jun 14, 2011, 1:54 AM EDT2 answers
Share
LinkedInX
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?

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Suthish Nair
    0
    Are u using CheckBoxList control and this is a web application?
    0
  • 0
    No, I'm not using a CheckBoxList and this is a Windows application.
    0