Hi
I asked this question some weeks ago, but have found no soluion yet, so I
try again
I have a parent detail relationship between two tables.
The detail records are shown in a datagrid (GridRemarks)
It is databound like this
GridRemarks.Datasource = mainDatasource ' a shortcut to
myDataSet.tblPersons.DefaultView
GridRemarks.DataMember ="tblPersons_tblRemarks" ' The name of the parent
detail relation
And it works fine
THE PROBLEM: But before I save I would like to end the current edits.
So I tried like this
Dim bmRemarks As BindingManagerBase = BindingContext(mainDataSource,
"tblPersons_tblRemarks")
bmRemarks.EndCurrentEdit()
And like this
Me.BindingContext(GridRemarks.DataSource,
GridRemarks.DataMember).EndCurrentEdit()
But to no avail.
I do not get any errors. It just does not end the current edit.
And my Dataset.HasChanges test is (of course) negative
Now I have tried to write code like this:
Dim myDataGridCell As DataGridCell = Me.GridRemarks.CurrentCell
Dim bm As BindingManagerBase = _
BindingContext(Me.GridRemarks.DataSource, Me.GridRemarks.DataMember)
Dim drv As DataRowView = CType(bm.Current, DataRowView)
Debug.WriteLine("Værdi: " & drv(myDataGridCell.ColumnNumber))
Debug.WriteLine("Row: " & myDataGridCell.RowNumber)
And it works fine and writes the correct values to the debug window
So I guess the bindingmanagerbase is correct. It just will not end the
currentedit
Any suggestions?
TIA
Jan