Question Binding combobox

mwthomas

New member
Joined
Jan 17, 2011
Messages
2
Programming Experience
1-3
Hi

For school I'm making a project for a party and I have a problem with getting a selected item in my combobox.

I have a window with a combobox and a listview.
The listview contains 'stock-objects' (has a ProductID, PartyID, OrderedAmount, Price,...). The combobox is filled with products (with an override function, It shows just the ProductNames).
These products have an ID & a NAME.

Now, If I click on an item in the listview I want the ProductName of that corresponding ProductID to be selected in the combobox.
This has to be done with Binding, but I don't know how.


Anyone has a guess?
Thanks
Thomas
 
Set the DisplayMember of the control to the name of the property or column of the items you want to display to the user. Set the ValueMember to the name of the property or column you want to use in code. You then bind the data by assigning the list to the DataSource. When the user selects an item, you can get the corresponding data from the SelectedValue property. Likewise, you can set the SelectedValue property to select the item with that data.
 
Back
Top