Index of Currently Selected Row in DataGridView

后端 未结 12 1818
误落风尘
误落风尘 2020-11-28 22:46

It\'s that simple. How do I get the index of the currently selected Row of a DataGridView? I don\'t want the Row object, I want the in

12条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 23:25

    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.

提交回复
热议问题