I have a form with a bunch (maybe 30) different controls that generate events
when changed, clicked, etc. The various event handlers in turn might change
some of these controls, thereby causing other events, which is not what I
want. So, is there a simple way to turn off all events for a particular
form, then turn them all back on? I know I can individually turn them off
and on by using -= and += but that seems like a pretty brutal thing to have
to do. There should be some simple soultion like the equivalent of "disable
interrupts" and "enable interrupts".
Thanks,
Ray 3 1883
Ray,
No, there isn't. You have to be mindful of how the actions taken up in
event handlers can trigger new events to be fired. You either have to
remove the event handlers at the appropriate time, as you stated, or use
state flags to indicate what events you are currently handling, and prevent
reentrancy.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Ray Mitchell" <Ra************ *****@MeanOldTe acher.comwrote in message
news:7E******** *************** ***********@mic rosoft.com...
>I have a form with a bunch (maybe 30) different controls that generate events
when changed, clicked, etc. The various event handlers in turn might
change
some of these controls, thereby causing other events, which is not what I
want. So, is there a simple way to turn off all events for a particular
form, then turn them all back on? I know I can individually turn them off
and on by using -= and += but that seems like a pretty brutal thing to
have
to do. There should be some simple soultion like the equivalent of
"disable
interrupts" and "enable interrupts".
Thanks,
Ray
Some controls offer BeginUpdate / EndUpdate pairs that sometimes do
this - but in general a form-level "isUpdating " variable (bool) might
be in order. Not very elegant, but it works.
Marc
Hi here,
Easy stuff
Have a bool or use the control's tag (if some control events still want to
fire)
--
cheers,
RL
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omwrote in
message news:ee******** *****@TK2MSFTNG P02.phx.gbl...
Ray,
No, there isn't. You have to be mindful of how the actions taken up in
event handlers can trigger new events to be fired. You either have to
remove the event handlers at the appropriate time, as you stated, or use
state flags to indicate what events you are currently handling, and
prevent reentrancy.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Ray Mitchell" <Ra************ *****@MeanOldTe acher.comwrote in message
news:7E******** *************** ***********@mic rosoft.com...
>>I have a form with a bunch (maybe 30) different controls that generate events when changed, clicked, etc. The various event handlers in turn might change some of these controls, thereby causing other events, which is not what I want. So, is there a simple way to turn off all events for a particular form, then turn them all back on? I know I can individually turn them off and on by using -= and += but that seems like a pretty brutal thing to have to do. There should be some simple soultion like the equivalent of "disable interrupts" and "enable interrupts".
Thanks, Ray
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Not Me |
last post by:
Hi,
Just trying to get my head around tab controls, is there anywhere which
would describe the structure of how they work? I seem to be ok so far,
being able to check which page I'm on etc... but I'm at a loss when
trying to access controls inside the tabs.
If I try to access the form directly (!...etc.) I get an error
that the form...
|
by: MLH |
last post by:
Having identified a A97 bug in which acDialog causes undesirable side
effects processing the opened form, I would like to replace the
following code running in MyForm ...
DoCmd.OpenForm "frmVehicleChooserForm", , , , , acDialog
.... (more code I want to run after suspension)
With this new approach...
DoCmd.OpenForm...
|
by: John Lau |
last post by:
Hi,
Is there documentation that talks about the page lifecycle, the lifecycle of
controls on the page, and the rendering of inline code, in a single
document?
Thanks,
John
|
by: Israel |
last post by:
The problem:
I want to know, definitively when a slider loses focus after a user has
started sliding and hasn't released the mouse yet. It appears that
this is captured with the WM_ACTIVATEAPP message but this only goes to
the form and I want it in the user control that maybe very much removed
from the form's knowledge; i.e. the form may...
|
by: Mohammad Hashemian |
last post by:
Hello
I'm writing an application and in one of it's forms I should dispose
all existing controls, create and initialize some new controls and then
add them to the form. so the form's appearance will be changed. But
during this transition, when I add a control to the form, that control
will be drawn momentarily. I want to know how can I...
| |
by: Rob |
last post by:
When a custom control is used within a form, that control does not get
events directly. I've run into this a couple times with both mouse
and keyboard events.
Ex: A custom control inherits from UserControl (or Panel, etc). If
that particular control is being edited, it IS possible to assign
handlers and get events.
However, when the...
|
by: |
last post by:
I have a user control (tag) made up up 9 smaller user controls (minitag).
I have a panel on a form that is being populated with 81 of the tag controls in a grid configuration.
Even though I am using Suspend Layout, I still see the controls getting drawn as they are added to the panel.
I've tried suspending the layout of the form, of the...
|
by: Dave |
last post by:
Hi all,
I have an application which has some worker threads which often have to stop
and wait for some further information from other threads. These pauses will
often take a long time (a couple of minutes) and I want the thread to be
able to begin work ASAP once the new information arrives so Thread.Sleep
isn't the best solution. In .NET...
|
by: Uzi |
last post by:
Hi all,
I have a thread which is running a long method in a third party
component (witch is a com object and accessed via interop).
I need to be able to suspend this thread.
the thread.Suspend() method is deprecated in .NET 2.0
the AutoResetEvent and similar are not good for me since my thread is
running an external method which I cannot...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |