I have this piece of code included on a tabpage that I originally had set with .SelectionChanged, but it would error when the rowheader was clicked. My issue is that the CurrentRow.Index is not set when I click outside an actual row. The code below, I realize now with RowEnter, has not initialized CurrentRow.Index.
What can I modify about this code where if a row becomes active in any certain way (clicked, coded, etc.) and also if headers are clicked that I can handle CurrentRow.Index. Do I just need to create an error handler with some 'ignore' code. I'm skeptical about that because of my 'PopulateParticipants' Sub where data is drawn from a dataview.
Thanks in advance!
Private Sub grdviewParticipants_RowChg(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grdviewParticipants.RowEnter
If Activating Then Exit Sub
Activating = True
If dvParticipants.Count > 0 Then
If grdviewParticipants.CurrentRow.Index >= 0 Then
grdviewParticipants.CurrentCell = grdviewParticipants.Item(3, grdviewParticipants.CurrentRow.Index)
glCurrentParticipantRow = grdviewParticipants.CurrentRow.Index
glParticipant = dvParticipants(grdviewParticipants.CurrentRow.Index)("participant_id").ToString
Activating = False