0

I have problem to select item from listbox and check item in checkedlistbox.

How can I select item from listbox and then check in checkedlistbox?

View My Project

I cant select listbox item and check checkedlistbox when match item

I want code for select checklistbox when item in listbox

How can check in checkedlistbox with textbox and seprated comma

BEHZADnr
  • 13
  • 1
  • 6

1 Answers1

0

if I understand your question right :

What you need is the method GetItemCheckState.

Usage as follows:

Try This :

  foreach (var item in listBox1.Items)
        {
            for (int i = 0; i < checkedListBox1.Items.Count; i++)
            {
                checkedListBox1.SetItemChecked(i, false);//First uncheck the old value!
                                                         //
                for (int x = 0; x < listBox1.Items.Count; x++)
                {
                    if (checkedListBox1.Items[i].ToString() == listBox1.Items[x].ToString())
                    {
                        //Check only if they match! 
                        checkedListBox1.SetItemChecked(i, true);
                    }
                }
            }


        }
Adds
  • 601
  • 2
  • 12
  • 24