General information
Category:
The Mere Mortals .NET Framework
It is most definitely the sort order messing things up. I took the sort order out and the New button functioned perfectly.
I haven't looked into the framework source yet, but I was trying to go the route of using the RowAdded event of the grid view:
Private Sub dgvSummary_RowsAdded(ByVal sender As System.Object, ByVal e As _
System.Windows.Forms.DataGridViewRowsAddedEventArgs) Handles dgvSummary.RowsAdded
Me.BindingContext(Me.mdacAttorney.GetCurrentDataSet(), "Attorney").Position = dgvSummary.Rows.Count
SelectGridRow(e.RowIndex)
...
SelectGridRow() is a function I added that basically just manually sets the selected grid row and ensures the scroll position is set so that the selected row is actually in view. This method works. The newly added row does become selected. However, my attempt to update the BindingContext position in the prior instruction fails, and so the very last record in the grid gets loaded into the detail view. Obviously this is not good when trying to add a new record.
For position values I tried the grid row count (as above), the grid row count - 1, and also e.RowIndex. NONE of these work. In all cases the last record of the pre-existing data is loaded into the detail view.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only