Some event handlers for WinForm DataGridView have DataGridViewCellEventArgs as a parameter and a ColumnIndex as a property of this argument.
ColumnIndex is a number indicating the ordinal number of column #.
Is there a way to refer to the column name from this argument instead of the column index?
So instead:
if (e.ColumnIndex == 1)
I prefer something like:
if (e.ColumnName == "CustomerName")
because if the column changes its position, it will break the code.
winforms datagridview
Tony_henrich
source share