In a DataGridView, I allow the user to change a cell, which fires the
CellValueChanged event (which I use to validate the cell contents),
followed by the EndCellEdit event, which I use to doctor the entry
(eg, change to upcase, etc). The problem is that when I doctor the
cell contents, the CellValueChanged event is fired a second time.
I want to do the following:
In CellClick ...
[Turn off the CellValueChanged event]
BeginEdit (true);
In EndCellEdit ...
[Turn on the CellValueChanged event]
doctor the contents
The question is, how do I turn off an event. I can think of two ways;
1. Use a flag.
2. m_Event = new DataGridViewCellEventHandler (ProcName);
x.CellValueChanged -= m_Event
x.CellValueChanged += m_Event
Is one way better / safer than the other?
Dom