HOW TO GET THE INDEX OF CURRENTLY SELECTED ROW IN DATAGRIDVIEW USING C#

Mark Devid

Total Post:102

Points:714
Posted by  Mark Devid
C# 
C#
 4575  View(s)
Ratings:
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).

  1. Dag Hammarskjold

    Post:24

    Points:168
    Re: How to get the Index of Currently Selected Row in DataGridView using C#

    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.

      Modified On Mar-31-2018 04:44:23 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!