获取当前单元格的列索引中的DataGridView CurrentCellChanged事件 [英] Get current cell column index in DataGridView CurrentCellChanged Event
问题描述
我有一个 DataGridView的
的 CurrentCellChanged
事件处理程序,我想能够访问当前选中的单元格列索引从事件处理程序。
我曾经有过在有 CellClick
处理程序的代码 DataGridViewCellEventArgs
作为参数,所以我能够从事件参数的参数,但 CurrentCellChanged
事件具有 EventArgs的$ C列索引$ C>因为我相信这是应该意味着世界上没有数据,此事件的参数。
是否有访问新的当前所选单元格的列索引?
使用 DataGridView.CurrentCell
属性..
的http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.currentcell.aspx
INT参数:columnIndex = dataGridView.CurrentCell.ColumnIndex;
INT的rowIndex = dataGridView.CurrentCell.RowIndex;
的 http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.aspx
I have the CurrentCellChanged
event handler of a DataGridView
and i want to be able to access the current selected cells column index from the event handler.
I used to have the code in the CellClick
handler which has DataGridViewCellEventArgs
as a parameter so i was able to get the column index from the event args parameter but the CurrentCellChanged
event has EventArgs
as parameters which i believe is supposed to imply that theres no data for this event.
Is there a way to access the new currently selected cells column index?
Use DataGridView.CurrentCell
property ..
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.currentcell.aspx
int columnIndex = dataGridView.CurrentCell.ColumnIndex;
int rowIndex = dataGridView.CurrentCell.RowIndex;
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.aspx
这篇关于获取当前单元格的列索引中的DataGridView CurrentCellChanged事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!