Question run item from checkbox list


New member
Mar 21, 2018
Programming Experience
I have build application in visual C# Which have checkbox list what I need to do to run each item if its selected one by one example the check box list include list of item


I need when I press on start button if first item selected then open new form called hi and close it then run next item in the list if it selected and open anther form and run it till it get to the end then stop
I really appropriate your help since I am a new started using C#
You have posted this in the Windows Forms forum so do you actually mean a CheckedListBox? Please use the actual names of things rather than a vague approximation. It's not hard and it helps avoid confusion. In this case, there is a Web Forms control called CheckBoxList so either you are using the wrong name or you've posted in the wrong forum. Even if it's the latter, "checkbox list" is still not the same as "CheckBoxList" so please make the tiny extra effort and use the actual name.
Do you mean something like this

            for (int i = 0; i<= list.Items.Count-1; i++)            {
                var z = list.Items[i] as CheckBox;

                if (z != null)
                    if (z.IsChecked == true && i == 0) //first item checked and determined by index
                        var window = new Window2();


if you have a WPF window with a nested CheckBox:

<ListBox x:Name="list">
<CheckBox Name="cb" >Initialize</CheckBox>

you can access the item. If you bound an ObservableCollection you can iterate through the properties as well.
Top Bottom