Question combo box value and text in vs 2008 for windows application

mazez1971

Member
Joined
Dec 23, 2009
Messages
13
Programming Experience
Beginner
hi, i want to load customerID and customerName in a combo bom. ID will be invisible and name will be visible in column using visual basic 2008 for windows application. thanx
 
Use the tag field to stored the ID.

VB.NET:
MyComboBox.Tag = CustomerID

The tag field is basically storage in controls for things like that, that you wish to not display but associate with the control.
 
thank you so much.
one more thing, is it possible to load more than two field. for example, CustomerID (col 1, ValueMember), CustomerName (Col 2,DisplayMember), CurrentBalance (col 3, DisplayMember)
 
When you first put a value into the tag:

VB.NET:
    Dim colIDs as New Collection
    colIDs.Items.Add(CustID)
    MyComboBox.Tag = colIDs

When looking to add another item to the collection

VB.NET:
        Dim colIDs As Collection = DirectCast(MyComboBox.Tag, Collection)
        colIDs.Add(CustID)
        MyComboBox.Tag = colIDs
 

Latest posts

Back
Top