D
Dom
In a datagridview, I sometimes capture the EditBoxShowing event and
then do the following:
TextBox txtEditControl = (TextBox)e.Control;
txtEditControl.KeyPress += new
KeyPressEventHandler(txtEditControl_KeyPress);
base.OnEditingControlShowing(e);
It occurs to be, though, that I just assume the system is creating a
new TextBox each time, one that does not have an eventhandler for the
KeyPress event. Am I just adding multiple eventhandlers to the same
control? If so, is there a way to get rid of them? I tried this ...
foreach (KeyPressEventHandler h in
txtEditControl.KeyPress) { txtEditControl.KeyPress -= h;}
.... but no go.
Dom
then do the following:
TextBox txtEditControl = (TextBox)e.Control;
txtEditControl.KeyPress += new
KeyPressEventHandler(txtEditControl_KeyPress);
base.OnEditingControlShowing(e);
It occurs to be, though, that I just assume the system is creating a
new TextBox each time, one that does not have an eventhandler for the
KeyPress event. Am I just adding multiple eventhandlers to the same
control? If so, is there a way to get rid of them? I tried this ...
foreach (KeyPressEventHandler h in
txtEditControl.KeyPress) { txtEditControl.KeyPress -= h;}
.... but no go.
Dom