"Yavuz Bogazci" <ya***@bogazci.com> schrieb
i have a question: how can i add items to my comboboxes
with more informations. For Example i want to show the
names of my customers an behind the names i want to store
id's or phonenumbers or something else. i don't want to
have a database!
You can add any type of object to a combobox. The ToString function of the
object returns what has to be displayed in the combobox.
Taken from a previous post:
class MyComboitem
public readonly ID as integer
public readonly Text as string
public sub new(byval ID as integer,byval Text as string)
me.id=id
me.text=text
end sub
public overrides Function ToString as string
return Text
end function
end class
'code adding items:
dim item as mycomboitem
item = new mycomboitem(theid, thetext)
combobox1.items.add(item)
'to retrieve the id from an item:
dim item as mycomboitem
item = directcast(combobox1.items(0), mycomboitem)
msgbox(item.text)
--
Armin