ArtK ArtK - 1 year ago 62
C# Question

Can't get correct value from Item in CheckedBoxList

Given that I added an item to

this way:


And let's say that this is the only item in the control:

string s = checkedListBox1.GetItemText(0);

Now the value of s is
when I expect
. Why can't I get correct value using
checkedListBox1.GetItemText(int itemIndex)

Answer Source

You should pass the object which is an item of CheckedListBox to GetItemText:


Otherwise GetItemText returns ToString of passed object.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download