Index of Currently Selected Row in DataGridView

后端 未结 12 1816
误落风尘
误落风尘 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:01

    try this it will work...it will give you the index of selected row index...

    int rowindex = dataGridView1.CurrentRow.Index;
    MessageBox.Show(rowindex.ToString());
    

提交回复
热议问题