I am taking user names and id from a database and dropping it into a combo box for users to select there name. in vb 6 i used to do the following:
do until rs.eof = true
with me.combobox.comboitems.add(,, rs.fields("Name"))
.tag = rs.fields("ID")
end with
rs.eof.movenext
loop
the combobox text would hold the name, and the tag would hold the id hidden from the user..
in vb.net 2008, i am having a hard time setting the .tag for combo items and have basically given up on it and turned to new measures.
one, i was going to load the users table into a localdatabasecache, and use the IDs and names from there, which i can't seem to get to work properly (mysql database, it only wants to accept microsoft sql)
second, create an array that holds the ids and just select the same index of the array vs the index of the combobox, which i cant get to work right (not good with arrays)
third is to just pull the id again after the name is connected - which causes another database connection and isn't really want i want to do.
question: what is the best method to go about this in .net 08
any help with this would be greatly appreciated.
Thanks