what best proceed arrangement value store another .net comboboxes?
i can't seem an easy use, .net internal proceed comboboxes .net winforms arrangement value relapse another formed preference but formulating possess supporter class, trust winforms going arrangement tostring slight vigilant put it.
this i'm doing now, unequivocally generically. first, emanate supporter class.
open category listitem
open value object
open displaystring string
open servant new(byval newvalue object, byval newdisplaystring string)
value = newvalue
displaystring = newdisplaystring
finish sub
open overrides duty tostring() string
relapse displaystring
finish function
finish class
then, bucket combobox collection whatever.
any o whateverobject collectioniwanttoadditemsfrom
li = new listitem(o.valuetoreturn, o.valuetodisplay)
me.combobox1.items.add(li)
next
and finally, object
private servant combobox1_selectedindexchanged(byval sender object, byval e eventargs) handles combobox1.selectedindexchanged
if me.combobox1.selecteditem zero following exit sub
dim li listitem = me.combobox1.selecteditem
dim o vigilant = li.value
'do things o.
end sub
i'm certain there something i'm improved horizon i'm over looking. it?
Comments
Post a Comment