在数据网格视图中获取单元格的行号 [英] Get row number of a cell in data grid view
本文介绍了在数据网格视图中获取单元格的行号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!
我想要获取数据网格视图中所选单元格的行号的代码以及可以选择行中其他单元格的代码。 :D
谢谢你
doostl
解决方案
你需要学习然后尝试自己:
如何:获取Windows窗体DataGridView控件中的选定单元格,行和列 [ ^ ]
或,使用:
datagridview.CurrentCell.RowIndex
获取所选单元格的行号。
特别感谢ridoy以及其他帮助我需要和获得的确切代码:
private void dataGridView1_CellMouseClick( object sender,DataGridViewCellMouseEventArgs e)
{
int i = 0 ;
dataGridView1.Rows [dataGridView1.SelectedCells [i] .RowIndex] .Selected = true ;
i ++;
}
MsgBox(DataGridView1.Item(0,DataGridView1.CurrentCell.RowIndex).Value)
Hi!
I wanna the code that get the row number of a selected cell in data grid view and the code that can select other cells in the row. :D
thank U
doostl
解决方案
You need to study it and then try yourself:
How to: Get the Selected Cells, Rows, and Columns in the Windows Forms DataGridView Control[^]
Or,Use:
datagridview.CurrentCell.RowIndex
to get the row number of a selected cell.
special thanks to ridoy and others who helped
the exact code that i need and got:
private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { int i = 0; dataGridView1.Rows[dataGridView1.SelectedCells[i].RowIndex].Selected = true; i++; }
MsgBox(DataGridView1.Item(0, DataGridView1.CurrentCell.RowIndex).Value)
这篇关于在数据网格视图中获取单元格的行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文