Thank you all for your input!
The reason for disabling events is that if e.g. all form controls are
initialized with a value from a database during load, it can be fatal if a
changed event fires and calculates new values from some of the controls that
hasn't yet finished updating - this is e.g. what I experied. However i found
something usefull, but it demands that one will have to do some work
himself:
EventHandler radioButtonEvent;
radioButtonEvent = new
System.EventHandler(this.radioButton1_CheckedChang ed);
And now the event can be turned on and off at will like this:
enabling the event:
radioButton1.CheckedChanged += radioButtonEvent;
disabling the event:
radioButton1.CheckedChanged -= radioButtonEvent;
Thanks,
Ole
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote
in message news:Oy**************@TK2MSFTNGP15.phx.gbl...
Hi,
You can remove all event handlers and in this case, when the event is
fired, nothing will happen.
Why would you need to disable an event in the first place?
--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx
"ORC" <or*@sol.dk> wrote in message
news:u0**************@TK2MSFTNGP15.phx.gbl... Hi,
Is it possible to disable an event like e.g. disabling:
private void textBox1_TextChanged(object....) ?
Thanks,
Ole