Calling superclass events from within the subclass

I subclassed a control and wrote code to the change event of the subclass. But there is also a change event in the superclass that should be done by the program.

How can I call the change event of the superclass from within the change event of the subclass?

Hank

Use:

RaiseEvent Change

Before or after your Change code, depending upon where you want the program to execute the Super event.

[quote=35471:@Hank Sinclair]I subclassed a control and wrote code to the change event of the subclass. But there is also a change event in the superclass that should be done by the program.

How can I call the change event of the superclass from within the change event of the subclass?

Hank[/quote]
you don’t
events travel “down” the class hierarchy - they are a nice simple way to implement “chain of responsibility”
so if you implemented the event in the super the subclass would no longer get the event UNLESS you have added an event definition to the super an the raised the event in the super

Sorry. Of course Norman is right.

You should place your code in the super’s Change event and then RaiseEvent at the end of that code so the subclass Change event will fire.

Norman says:

[quote=35491:@Norman Palardy]so if you implemented the event in the super the subclass would no longer get the event UNLESS you have added an event definition to the super an the raised the event in the super

[/quote]
But Simon says:

These are 2 different things - so who is right?

They are saying the same thing.

They’re saying the same thing. When you write your subclass, the Super class’s Change event fires and calls your Change event. If you want to pass the Change event on to instances of your subclass (on the window, for example) you would add an Event Definition to your subclass and call it from your Change event. As Norman said, event cascade down the chain from super to subclass.

Ok, I understand.

So I’ll raise the change event of the subclass from within the super class.

Thank you for your competent answers.