Victor Charles
asked on
Help with selecting first row in DataGridView
Hi,
After I load the GridView with a Data Table, How do I automatically select the first row, required to activate data in another Grid.
If FilteredDTA.Rows.Count > 0 Then
Me.C1A.DataSource = FilteredDTA
C1A.Rows(0).Selected = True '*** Does not work
End If
Thanks,
Victor
After I load the GridView with a Data Table, How do I automatically select the first row, required to activate data in another Grid.
If FilteredDTA.Rows.Count > 0 Then
Me.C1A.DataSource = FilteredDTA
C1A.Rows(0).Selected = True '*** Does not work
End If
Thanks,
Victor
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
My mistake, I used the wrong code. Since the code to load the first Grid is in the Form load event, to activate the code to view the data in the other other grid, I will also include the code in the Formload event.
Thanks,
Victor
My mistake, I used the wrong code. Since the code to load the first Grid is in the Form load event, to activate the code to view the data in the other other grid, I will also include the code in the Formload event.
Thanks,
Victor
ASKER
Thank You.
You may want to place that code in a Sub so that when you need it you can make a single call to it.
ASKER
That is a good idea, will do.
Thanks.
Victor
Thanks.
Victor
ASKER
I thought so too, but the first row is not highlighted, shouldn't it be highlighted when selected?
Thanks,
Victor