在DataGridView中当前所选行的索引 [英] Index of Currently Selected Row in 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).
推荐答案
还有就是<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.rowindex.aspx"><$c$c>RowIndex$c$c>属性的<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.currentcell.aspx"><$c$c>CurrentCell$c$c>属性DataGridView的。
There is the RowIndex
property for the CurrentCell
property for the DataGridView.
datagridview.CurrentCell.RowIndex
处理的<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.selectionchanged.aspx"><$c$c>SelectionChanged$c$c>事件,并找到所选择的行的索引如上
Handle the SelectionChanged
event and find the index of the selected row as above.
这篇关于在DataGridView中当前所选行的索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!