Information générale
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
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.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement