Hi,
I am create one application in which i use checkedlistbox. In checkedlist box i display all employee name and calculate id of particular checked employees. but how to check which employee's name checked in checked list box and how to compare this employee is checked or selected.

Regards,
shailaja

Recommended Answers

All 2 Replies

Found an old example. I am not sure if this will help out entirely but it should convey the general idea. You can retrieve the selected item value and /or the checklisted item alone, I created a form with a checklistbox, and two listboxes titled listbox1 and listbox2. Listbox1 one displays the selected item, and listbox2 displays all checked items. Here is the code snippet.

private void btnGetNames_Click(object sender, EventArgs e)
        {
            
            listBox1.Items.Add(checkedListBox1.Text); //adds only the selected item to listbox.


            for (int i = 0; i < checkedListBox1.CheckedItems.Count; i++)
            {
                listBox2.Items.Add(checkedListBox1.CheckedItems[i]); //adds only the checked items to listbox.
            }           
 

            

        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.