stop events from propagating

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a long list of questions. Most controls have events that detect when a value changes, which validates the form and possibly changes some other values.... Is there an easy way to disable all Control/Form events from firing as a result of anything done within a certain block of code

I have done something like this before, but I seem to remember the windows.forms having a nice and easy way to do this. The only way I can think to do it now is to have a bool flag "isUserEvent" that I set to false at the beginning of a change event and back to true at the end, then each answer change event checks the flag before doing anything

Thanks
--Oran
 
Hi Oran,

AFAIK there is no way to tell a form or control to suppress firing the its
events. What you can do is for events you want to control you can override
the respective OnXXX method and if you don't want to fire the event just
don't call the base implementation

--
HTH
B\rgds
100 [C# MVP]

Oran said:
I have a form with a long list of questions. Most controls have events
that detect when a value changes, which validates the form and possibly
changes some other values.... Is there an easy way to disable all
Control/Form events from firing as a result of anything done within a
certain block of code?
I have done something like this before, but I seem to remember the
windows.forms having a nice and easy way to do this. The only way I can
think to do it now is to have a bool flag "isUserEvent" that I set to false
at the beginning of a change event and back to true at the end, then each
answer change event checks the flag before doing anything.
 
Back
Top