Re: Set / Clear and restore control event handlers

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Stephany Young" <noone@localhost> wrote in message news:OhLyomozIHA.3968@xxxxxxxxxxxxxxxxxxxxxxx
RemoveHandler ....
...

code which would cause the control to fire an event.

AddHandler ....
...


"Lloyd Sheen" <a@xxx> wrote in message news:%23geL1pmzIHA.1236@xxxxxxxxxxxxxxxxxxxxxxx
Is there a way to get the event handlers such that I can cache the info about handlers for a particular control, remove the handlers, do some code and restore the cached event handlers in VB.NET (2008).

I would rather do things this way than having to have a boolean flag to indicated to the handler to exit right away.

Psuedo code:

CacheHandlers(control)

code which would cause the control to fire an event.

RestoreHandlers(control).

LS


Yes I know about the "norm" but what I am looking at doing is for a control (any control) to have a way of removing and then after some code restoring the event handlers. I am looking for a general method which would take into account that I would not know what to use for Addhandler and RemoveHandler so I am looking for a method to enumerate the "added" handlers and then cache the info, do a remove and when asked reset using AddHandler.

LS

.



Relevant Pages

  • Re: Set / Clear and restore control event handlers
    ... about handlers for a particular control, remove the handlers, do some code and restore the cached event handlers in VB.NET. ... I am looking for a general method which would take into account that I would not know what to use for Addhandler and RemoveHandler so I am looking for a method to enumerate the "added" handlers and then cache the info, do a remove and when asked reset using AddHandler. ...
    (microsoft.public.dotnet.languages.vb)
  • RE: Focus gets stuck on control which filling out form
    ... one thing I forgot to mention is that the GUI uses Data ... the user cannot change focus to another control. ... Have you hooked up handlers to events of the controls in the TabControl? ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • RE: Focus gets stuck on control which filling out form
    ... the user cannot change focus to another control. ... Have you hooked up handlers to events of the controls in the TabControl? ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Disabling Controls when BindingSource.Count == 0
    ... on my Windows forms so that when the BindingSource is empty some the ... We can't just go through every control and disable it since some ... public class DisableHelper: Component, IExtenderProvider ... private IDictionary<Control, Handlers> listeners; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How control where focus goes when dialog closes?
    ... Note that having OnSetFocus handlers creates fragile code, ... (to a Window that is some kind of 'ancestor' of X I think) ... the dialog's DoModal function has returned and call SetFocus then. ... when I close the message box, the focus always returns to the exact control ...
    (microsoft.public.vc.mfc)