How to know the row index from DataTable object

前端 未结 3 1707
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-30 09:07

I\'m getting a value from DataGridView, and based on particular I want to know its row index using DataTable object. For instance, if I get the value \"this\", then I want t

3条回答
  •  遥遥无期
    2020-12-30 09:40

    using System.Data;
    
    DataRowView row1 = (DataRowView)dataGridView1.CurrentRow.DataBoundItem;
    
    int idx11 = row1.Row.Table.Rows.IndexOf(row1.Row);
    

提交回复
热议问题