Ben Chase (12/04/2006)
Are you trying to figure out how to populate the combo box from data? or are the values static?
Are you just trying to figure out what event to handle so that you can run your sproc? I believe you'll want to use the CellValueChanged event for that. The event args will tell you the cell that changed, and you can use the value of that cell to run your sproc.The combobox population is no problem, I'm doing it manually as there are only three items to choose form.
OK, here are the problems I'm running into. If the column with the combobox is bound, then it tries to update the underlying datasource, which is no good (its readonly). I've tried adding another column, made IT the combobox, turned on VirtualMode for the grid and load it based on the data form the view (using CellValueNeeded), which is now in a hidden column. When I do this the CellValueChanged runs much latter than I'd like, like when I move to a new row or exit the form and it only runs because the value is being changed BACK to the original...sigh.
Let me provide more specifics:
The view is something like:
Select s.State, m.Info, m.masterID
From tblMaster as m Left Outer Join tblSpecific as s
on m.masterID = s.masterID
I'm trying to update s.State with the grid
I've a BO to this view, I add the BO, a BusinessBindingSource, A DataGridView to the form, then set the bindingsource of the grid to the BusinessBindingSource. I hide the State and MasterID columns, add a new column that is combobox column and set the grid to VirtualMode=true. I then load the unbound column to the State column in the CellValueNeeded event of the grid.
What I want to have happen is when the users selects a value from the combo, I grab that event and run a sproc. Hope this is clearer.