Home > DeveloperSection > Forums > How to get the Index of Currently Selected Row in DataGridView using C#
Mark Devid
Mark Devid

Total Post:102

Points:714
Posted on    October-05-2013 2:25 AM

 C# C# 
Ratings:


 1 Reply(s)
 2591  View(s)
Rate this:

How do I get the index of the currently selected Row of a DataGridView?

I don't want the Row object, I want the index (0 .. n).



Dag Hammarskjold
Dag Hammarskjold

Total Post:24

Points:168
Posted on    October-05-2013 4:12 AM

There is the RowIndex property for the CurrentCell property for the DataGridView.

datagridview.CurrentCell.RowIndex

Handle the SelectionChanged event and find the index of the selected row as above.


Don't want to miss updates? Please click the below button!

Follow MindStick