VB.NET - CheckedListBox problem

Asked By Cenk Nazlı on 28-Mar-07 07:45 AM

Hi everybody;

I have a checkedlistbox component and try to get the checked items as return value. But it forgets some of the checkeditems everytime. I think it seems like a bug of component. Is there any idea for solution? I use GetItemChecked property of component.

What checked list box component are you using?

Robert Stanton replied to Cenk Nazlı on 28-Mar-07 08:16 AM
Who makes it? Where did you get it from?

from Microsoft :)

Cenk Nazlı replied to Robert Stanton on 28-Mar-07 08:28 AM
In Visual Studio 2005 windows controls, there is a component named checkedListBox.

Ohh, When see the word component I automatically think third party component

Robert Stanton replied to Cenk Nazlı on 28-Mar-07 08:50 AM
Can you describe what you mean by it forgets some of the checked values? Give as much detail as possible.
I fix the problem
Cenk Nazlı replied to Robert Stanton on 28-Mar-07 09:04 AM

For example; you have 1,2,3 options in the checkedlistbox. I check 1 and 2 and run, but it returns only 2 as true. The problem is the wrong event. I was calling my sub when SelectedValue Event works. But I try to call the sub when Leave event works as follow;

AddHandler chklistbox.Leave, adressof mysub 

and it begin to work correctly.

Thank for your interest,

about checked item
varun kumar replied to Cenk Nazlı on 29-Mar-07 02:30 AM

Dim i As Integer

For i = CheckedListBox1.CheckedItems.Count - 1 To 0 Step -1

MessageBox.Show(CheckedListBox1.CheckedItems.Item(i))

Next