oh sorry! i didn't pay much attention to the properties name from the
sample.
have you try this :
'***
Dim ht As Hashtable = New Hashtable(3)
ht.Add("item 1", 1)
ht.Add("item 2", 2)
ht.Add("item 3", 3)
ListBox1.DisplayMember = "key"
ListBox1.ValueMember = "value"
Dim entry As DictionaryEntry
For Each entry In ht
ListBox1.Items.Add(entry)
Next
'***
note that for some reason you must affect DisplayMember and ValueMember
properties before adding the items or the displayed item might not be
correct... (plus i'm not quite sure why it's not the other way around)
--
Best Regards
Yanick
"Dave" <dave(delete_this)@miraclecatDELETETHISTOO.com> a écrit dans le
message de news:eO**************@tk2msftngp13.phx.gbl...
Bummer, this only works in ASP.NET.
"Zoury" <yanick_lefebvre at hotmail dot com> wrote in message
news:Om**************@TK2MSFTNGP14.phx.gbl... Hi Dave!
didn't test it but it seems ok
http://groups.google.com/groups?thre...40tkmsftngxa04
--
Best Regards
Yanick
"Dave" <dave(delete_this)@miraclecatDELETETHISTOO.com> a écrit dans le
message de news:OR**************@TK2MSFTNGP15.phx.gbl... Hi all,
Is it possible to populate a listbox from a hashtable (complexbind) where the ValueMember of the listbox maps to the "key" member of the
hashtable AND the DisplayMember of the listbox maps to the "value" member of the
hashtable?
I found that it is impossible to use a hashtable as a listbox
datasource directly (from trial and error) and tried DirectCast-ing to an
arraylist without any success. Before I spend anymore time in vain complex
binding, I thought I'd ask to see if anyone has figured a method of doing so.
D