G
Guest
I'm new to .net 2.0 and I'm trying to figure out the best way to create a
form that has a couple of controls and one of the controls is a combo box
with a data bound list of items from another table.
To understand the problem more, consider using the AdventureWorks2000
database. I want a simple form that shows FirstName, LastName, and Shift.
Instead of the ShiftID, I want the shift name from the Shift table to be
displayed.
Here's what I've tried:
1. Create dataset with Employee table and Shift Table.
2. Drag employee FirstName and LastName on the form
3. A BindingNavigator and BindingSource were created when FirstName was
dragged onto the form.
4. Change ShiftID to a comboBox and drag it onto the form
5. Configure the combobox to bind to the ShiftBindingSource
6. Select ShiftId as the Value Memeber.
7. Select Name as the Display Member
I have two problems:
1. Once the data item list is displayed in the combobox, the Display Member
(Shift.Name) is not the right display member for the display value
(employee.ShiftId). Do I have to synchronize the two BindingSources? Do I
have to use only one BindingSource and join Employee and Shift in one query?
Something else?
2. How do I make ShiftID get inserted or updated in the employee table from
a selection in the comboBox?
form that has a couple of controls and one of the controls is a combo box
with a data bound list of items from another table.
To understand the problem more, consider using the AdventureWorks2000
database. I want a simple form that shows FirstName, LastName, and Shift.
Instead of the ShiftID, I want the shift name from the Shift table to be
displayed.
Here's what I've tried:
1. Create dataset with Employee table and Shift Table.
2. Drag employee FirstName and LastName on the form
3. A BindingNavigator and BindingSource were created when FirstName was
dragged onto the form.
4. Change ShiftID to a comboBox and drag it onto the form
5. Configure the combobox to bind to the ShiftBindingSource
6. Select ShiftId as the Value Memeber.
7. Select Name as the Display Member
I have two problems:
1. Once the data item list is displayed in the combobox, the Display Member
(Shift.Name) is not the right display member for the display value
(employee.ShiftId). Do I have to synchronize the two BindingSources? Do I
have to use only one BindingSource and join Employee and Shift in one query?
Something else?
2. How do I make ShiftID get inserted or updated in the employee table from
a selection in the comboBox?