Richard,
In addition to the other comments:
| Hi, I need to "save" in a variable the event handler sub of a control's
| event, then perform some process, and finally "restore" the originally
saved
| event handler.
There may be multiple event handler subs for a single events, is there a
specific handler you want to save or do you want to save the entire list?
The "problem" is that the list of event handlers are not publicly available.
Different classes store the list differently. A number of framework classes
store the handlers in the Component.Events member:
http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx
While the convention for VB classes is a hidden field named for the Event,
for example the MyValueChanged event keeps the list in the
MyValueChangeEvent field.
VB 2005 can use Custom Events to store the list of event handlers in the
Component.Events member.
http://www.panopticoncentral.net/arc...8/06/1545.aspx
Gaining access to this list for classes other then your own, is problematic
at best, in that how the list is stored is an implementation detail that
could change...
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
"Richard Grant" <Ri**********@discussions.microsoft.com> wrote in message
news:37**********************************@microsof t.com...
| Hi, I need to "save" in a variable the event handler sub of a control's
| event, then perform some process, and finally "restore" the originally
saved
| event handler.
|
| Example in pseudo-code:
|
| 1) Save cmbMyCombo's event handler for SelectedIndexChange event.
|
| 2) Assign a temporary event handler sub to cmbMyCombo's for its
| SelectedIndexChange event.
| AddHandler cmbMyCombo.SelectedIndexChanged, AddressOf
| cmbMyCombo_SelectedIndexChanged_Temporary
|
| 3) Do some processing...
|
| 4) Restore the previously-saved event handler sub for the
| SelectedIndexChange event to cmbMyCombo.
|
| How can this be accomplished? Thanks in advance.
|
| Regards,
|
| Rick