Using CheckedListBox

Using CheckedListBox

It is one of the list type objects used in the Visual C# programming language. Similar to ListBox but a checkbox is created next to each element. The desired element or elements can be selected by ticking the checkbox.

If we want to process the selected elements in the CheckedListBox object, for example, if we want to combine all the selected elements and print them somewhere, we can use the following method:

foreach(object a in checkedListBox1.CheckedItems)
{
    label1.Text += a.ToString() + " ";
}

The foreach loop is used in the above example. Foreach loop is a special loop sequence and used for the collection , with all elements it allows us to process respectively.

The checkedListBox1.CheckedItems expression allows us to obtain a collection of selected elements . All the elements in this collection are taken into an object of type object in order and desired operations can be performed with object a in the loop.

CheckedListBox tutorials in c#, CheckedListBox selected elements printing, printing CheckedListBox items, How to use CheckedListBox, CheckedListBox example

EXERCISES

There are no examples related to this subject.



COMMENTS




Read 656 times.

Online Users: 179



using-checkedlistbox