CheckedListBox: DisplayMember not working?

M

Matt C.

Does the CheckedListBox support DisplayMember/ValueMember?

I have been trying to use these properties with the CheckedListBox and they
are not working. I see from Google that databinding is not supported on
this control. Ok, fine. I tried to work around this by using
DictionaryEntries, which still didn't work (see code below). Now I see in
VS Help that DM/VM are not even listed as properties of the CheckedListBox
(they are in VS intellisense, though. argh!).

My guess is what I am trying to do is not supported with the CheckedListBox.
But the CLB is the right visual presentation for what I want. Is there a
way to make the CheckedListBox work in a DM/VM fashion, or some other well-
functioning alternative to the CLB?

Thanks for any advice,
Matt


Protected Overridable Sub InitCheckedListBox(ByRef clb As
CheckedListBox, ByVal dv As DataView, ByVal DispColumn As String, ByVal
ValColumn As String)

Dim de As DictionaryEntry

clb.Items.Clear()

clb.DisplayMember = "Key"
clb.ValueMember = "Value"

For Each drv As DataRowView In dv
de = New DictionaryEntry(drv(DispColumn), drv(ValColumn))
clb.Items.Add(de)
Next

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top