Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Guys,
I'm creating a Windows Forms based application using visual studio 2008.
I'm slowly getting the hang of all the Dataset, Binding Source, Table Adapter stuff.

I'm trying to add a Combo box to my form and populate it from a lookup table.
Then save the selected ID back to the data table and it is driving me insane.
I have tried every combination I can think of in the "Data Binding Mode" properties dialog and it still doesn't work properly.

To simplify things I have created a one form project and dragged Transaction Record ID field from the Data Sources tree (Dataset) onto the form.

Next I dragged the ID Field of the drop down list (same transaction table) from the Data Sources tree (Dataset) onto the form.

Logically I now need to tell the combo box to display the description filed from the look up table based on the currently selected ID in the transaction record.

All of the examples I have found so far have descriptions for editing the code directly. This seems like a simple GUI thing to do.

The Combo box dialog has 4 fields.
Data Source
Display Member
Value Member
Selected Value

I assume I just need to set these four correctly for it to work. I have tried every combination I can think of. I either get no initial value when a valid record is shown on the form and the correct text description is in the drop down or the ID is shown in the Drop Down and not the text.
It also seems to hang if I try and change / set a value in the drop down.

Any ideas where I'm going wrong and / or does anyone know of a decent explanation of how to use this properly?

Thanks in Advance
David
Posted

1 solution

 
Share this answer
 
Comments
David_Pollard 29-Sep-15 2:49am    
I put this problem on the back burner for a while and went on to other things.
When I came back I had no problem Binding the combo box to the data source exactly as you would expect. (In the GUI)
The solution you proposed looks very nice so I accepted it as an answer :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900