wd006451
asked on
Tag for the ComboBox
Hello, how do i set a tag for the combo box?
ASKER
Actually, i want it actually for an item that is in the combo box, so each item will have its own tag, i can make it work for a listbox, etc... but i can't figure it out for this one....
Dim folderDataInfo() As cFolderData
Dim i As Integer = 0
folderDataInfo = serverConnection.GetFolder sForUser(c urrentLogg edInUserDa ta.ID)
Me.cmbFolders.Items.Add(" -- SELECT ONE --")
For i = 0 To folderDataInfo.Length - 1
Me.cmbFolders.Items.Add(fo lderDataIn fo(i).name )
me.cmbfolders.items(i).fol derDataInf o(i).ID() '<---- Not working...
Next
Me.cmbFolders.SelectedInde x = 0
Dim folderDataInfo() As cFolderData
Dim i As Integer = 0
folderDataInfo = serverConnection.GetFolder
Me.cmbFolders.Items.Add(" -- SELECT ONE --")
For i = 0 To folderDataInfo.Length - 1
Me.cmbFolders.Items.Add(fo
me.cmbfolders.items(i).fol
Next
Me.cmbFolders.SelectedInde
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Bummer
The tag property of a control holds an Object. So to assign an object to the ComboBox.Tag you can do it this way:
ComboBox1.Tag = "Hello World"
to get the Object out you would do this:
Dim str As String = CType(ComboBox1.Tag, String)
If the Tag property can holds any type
ComboBox1.Tag = TheObjectToStore
to get the Object out you would do this:
Dim str As TheObjectToStore= CType(ComboBox1.Tag, TheObjectToStore)
I hope that this is of some help.
Fernando