Link to home
Start Free TrialLog in
Avatar of wd006451
wd006451

asked on

Tag for the ComboBox

Hello, how do i set a tag for the combo box?
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Hi wd006451;

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
   
Avatar of wd006451
wd006451

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.GetFoldersForUser(currentLoggedInUserData.ID)

    Me.cmbFolders.Items.Add("  -- SELECT ONE --")
    For i = 0 To folderDataInfo.Length - 1
      Me.cmbFolders.Items.Add(folderDataInfo(i).name)

      me.cmbfolders.items(i).folderDataInfo(i).ID() '<---- Not working...
    Next
    Me.cmbFolders.SelectedIndex = 0
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Bummer