Click here to Skip to main content
15,888,302 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all ,

Here is the question , i want to collect the selected indices of the items in the checked list box control dynamically ....

thnx
Posted
Comments
Praveen Kullu 11-Aug-11 4:01am    
you didn't mention where you want to collect the items..

Iterate over them and build a list of ints that contains only the ones that are checked. Assuming there's no property for that already, which would surprise me.

I guess you don't have google where you live. I do, so I was able to find this:

http://msdn.microsoft.com/en-us/library/system.windows.forms.checkedlistbox.checkedindexcollection.aspx[^]

However, surely you get the full visual studio ? It has intellisense. Hit . and you get a list of methods on the object. Surely 'CheckedItems' is self documenting ?
 
Share this answer
 
I believe you were asking for this:

C#
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
       {
           if (e.NewValue == CheckState.Checked)
           {
               MessageBox.Show(e.Index.ToString());
           }
       }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900