471,357 Members | 1,094 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,357 software developers and data experts.

CheckedListBox: DisplayMember not working?

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
Jul 21 '05 #1
0 4307

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Steve Cutting | last post: by
reply views Thread by Matt C. | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.