Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear professionals,
simple dummy question from beginner.
in my app the user will select the rows in the data GridView.
i want to get the start and end indexes of his selection.
Posted

as below...
VB
dim First_selected_row_Ind = dataGridView1.SelectedRows(0).Index

dim Last_selected_row_Ind = dataGridView1.SelectedRows(datagridview1.selectedrows.count-1).Index

Happy Coding!
:)
 
Share this answer
 
SQL
If DGV1.SelectedRows.Count > 0 Then
               ENDROW = DGV1.SelectedRows(0).Index
               STARTROW = DGV1.SelectedRows(DGV1.SelectedRows.Count - 1).Index
               Dim TEMPROW As Integer
               If ENDROW < STARTROW Then
                   TEMPROW = ENDROW
                   ENDROW = STARTROW
                   STARTROW = TEMPROW
               End If
           End If





i added the above as selection may be upward or downward....appreciate your help Mr.Meswania
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900