Unbound combo box / listbox problem
Hi all!
Question... Can an unbound control in VB2005 receive ID values from a class?
For example...
-----------------
'this would populate the names of a class, but not pass in any ID numbers from the database
Dim RecordCol As RecordCollection = [ClassName].GetAllRecords
Dim i As Integer
For i = 0 To (RecordCol.Count - 1)
Combobox1.Items.Add(RecordCol.Item(i).Name.ToStrin g)
Next i
-----------------
I realise I can use the datasource property, but I don't want to purely because I'm a mega "anti-databound" type developer. I also know that using the valuemember and selectedvalue properties may be of some use, but I can't figure out a way of doing it the way I am.
Using VB6 this was simply acheived by doing:
---------------
Combo1.Additem("Item1")
Combo1.ItemData(Combo1.NewIndex) = RecordSet("FieldName")
---------------
I've tried the beginners forum, but not had any answers (and it's a week old).
Hope someone can help...
Kind regards,
Craig
__________________
Kind regards,
Craig
|