在DataGridView中当前所选行的索引

问题描述:

就这么简单。如何获取当前选定的 A行的DataGridView 的指数?我不想让的对象,我想指数(0 .. N)。

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 index (0 .. n).

还有就是RowIndex$c$c>属性的CurrentCell$c$c>属性DataGridView的。

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

datagridview.CurrentCell.RowIndex

处理的SelectionChanged$c$c>事件,并找到所选择的行的索引如上

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