Great, it works fantastic. I have another question I was hoping you might be able to help me with. I looked through the documentation but couldn't find an answer as it relates datasets and databound comboboxes.
Is there a way to fill the combo box items with data from another table, and have it below the data grid as in my first example, and still have it select the related employee record? Say in my employee table I have a 1 for Location. I have a Location table that has 1 as Los Angeles. When the user clicks on that employee record, Los Angeles is selected in the combo box, but all of the items from the Location table are in their so they can make the change if they want?
Thanks for any information you might be able to give me.
Logically, You cant have the same combo box do both navigation and data editing. THink about it:
If the user chooses a new value from the combo, did they choose it because they wanted to nav there or did they want to edit the current record column to that value
Because this logic is simple, it is manifested simply:
If the combo is databound (meaning its .SelectedItem, .SelectedValue, .Text or other property is bound to a certain column of a datatable) then it always operates in edit mode.
If the combo is not databound (note that setting the .DataSource/.DisplayMember/.ValueMember is NOT databinding in the context here, it is merely telling the combo where to get its item list from) but it gets its values from a data based list (like a datatable) then selecting an item will nav the default view or currency manager of that list, and any other controls that are also using that currency manager
-
To achieve what you ask:
Have a grid, showing the contents of TblOrders
Have a combo for the city:
.DataSource = TblAllCities
.DisplayMember = "CityName"
.ValueMember = "CityID"
.SelectedValue is bound to TblOrders.ShippingCityID column
Changing the combo will edit the value of TblOrders.ShippingCity