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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With