Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dropdownlist problem

Status
Not open for further replies.

msprygada

Programmer
Jul 17, 2003
3
0
0
US
I have a Visual Basic .NET windows application where I am using a dropdownlist that I cannot seem to get working the way I want.

My application contains a dataset that includes a customers table and a state table (gets filled with all 50 states) that are related by stateID (primary key in the state table, and foreign key in the customers table). I have created a relationship between those tables in my application. I have text fields databound to the customers table and can add, modify, and delete customers. I use the binding manager to scroll through the entered records in the customers table. This all works great.

The problem I am having is I want the dropdownlist to do two things: 1. Display the state of the displayed record when I am viewing records. 2. When I am adding or modifying a record, use the dropdownlist to select the desired state and have the dropdownlist update the stateID field of the customers table with the stateID. Is this even possible?

I can get the dropdownlist to display the states by databinding it to the state table in the dataset no problem, but cannot figure out how to get stateID to populate the field stateID in the customers table when I select the state from the dropdownlist.

I am not using any events of the dropdown list. If I should be (like change selected item), how do you get this to add the value to the customers table.

If it is not possible, how would one use the dropdownlist to populate a field where you want control over data entry? It seems like what I am doing should be straight forward.

Thanks in advance....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top