Tag for the ComboBox

Hello, how do i set a tag for the combo box?
LVL 1
wd006451Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fernando SotoRetiredCommented:
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
   
0
wd006451Author Commented:
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
0
Fernando SotoRetiredCommented:
Hi wd006451;

The ComboBox does not have a ValueMember for each item in the list as the ListBox does and therefore this is not possible unless you create you own version of the ComboBox as a user control.

Fernando
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wd006451Author Commented:
Bummer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.