I have a singleton class (a music player) then raises events. I originally
dim an instance of this class in my main form using withevents and have event
handlers for the singleton in this main class. Then in another form that I
show on top of the original form, I get an instance of the singleton and also
have event handlers in this form for the singleton's events.
I noted that when the singleton class raises an event, it gets routed to the
event handler in the main form then following that, it is routed to the event
handler in the second form. I pass a current parent object in each event and
check in the event handlers if the parent is that class and exit the handler
immediately if not.
Is this considered acceptable programming or am I going to get into trouble.
I know that instead of using "withevents ", I can use Add Handler and Remove
handler to avoid double firing of events but would rather not do it this way.
--
Dennis in Houston
dim an instance of this class in my main form using withevents and have event
handlers for the singleton in this main class. Then in another form that I
show on top of the original form, I get an instance of the singleton and also
have event handlers in this form for the singleton's events.
I noted that when the singleton class raises an event, it gets routed to the
event handler in the main form then following that, it is routed to the event
handler in the second form. I pass a current parent object in each event and
check in the event handlers if the parent is that class and exit the handler
immediately if not.
Is this considered acceptable programming or am I going to get into trouble.
I know that instead of using "withevents ", I can use Add Handler and Remove
handler to avoid double firing of events but would rather not do it this way.
--
Dennis in Houston