S
Sam
Ok.
I have a dataset with a datatable called "Books".
Books contains ISBN, TITLE, and AUTHOR
In my datagrid, I only show TITLE and AUTHOR
I also have a dataview set up with it:
cm = CType(Me, Control).BindingContext(grdBooks.DataSource, _
grdBooks.DataMember)
m_dvwBookView = CType(cm.List, DataView)
I want to be able to keep the row selected, even after the user
re-sorts the datagrid by clicking on a column heading. I can store
the selected ISBN number when the user selects a new row, but I can't
figure out how to find the row with that ISBN #, after the user has
sorted by say TITLE. I can get the event when a user sorts by title
or author with the DataViews ListChanged event:
Private Sub m_dvwBookView_ListChanged(ByVal sender As Object, _
ByVal e As System.ComponentModel.ListChangedEventArgs) _
Handles m_dvwBookView.ListChanged
If (e.ListChangedType = ComponentModel.ListChangedType.Reset) Then
grdBooks.Select(OldRowSelected)
End If
End Sub
I can't figure out how to get the new row index of the previously
selected row. Any ideas?
Thanks...
I have a dataset with a datatable called "Books".
Books contains ISBN, TITLE, and AUTHOR
In my datagrid, I only show TITLE and AUTHOR
I also have a dataview set up with it:
cm = CType(Me, Control).BindingContext(grdBooks.DataSource, _
grdBooks.DataMember)
m_dvwBookView = CType(cm.List, DataView)
I want to be able to keep the row selected, even after the user
re-sorts the datagrid by clicking on a column heading. I can store
the selected ISBN number when the user selects a new row, but I can't
figure out how to find the row with that ISBN #, after the user has
sorted by say TITLE. I can get the event when a user sorts by title
or author with the DataViews ListChanged event:
Private Sub m_dvwBookView_ListChanged(ByVal sender As Object, _
ByVal e As System.ComponentModel.ListChangedEventArgs) _
Handles m_dvwBookView.ListChanged
If (e.ListChangedType = ComponentModel.ListChangedType.Reset) Then
grdBooks.Select(OldRowSelected)
End If
End Sub
I can't figure out how to get the new row index of the previously
selected row. Any ideas?
Thanks...