Alternative To Super.Constructor

What can I use instead of Super.Constructor but with an event other than the Constructor event. Should I just give the superclass a method to execute. Thanks.

I don’t understand the problem. Do you want a subclass to be able to inject code into the constructor? If so, then define an event in the superclass and raise it from within the constructor. Then subclasses can simply implement the event.

This has nothing to do with the constructor, I just used that as an example. I want to be able achieve the same thing as super.constructor but instead of it executing all of the code in the constructor event, I want it to execute all of the code in another event, in my case its text change event so the first thing I would think to write is ‘super.TextChange’. Thanks for your time.

Constructors aren’t events and events can only be raised from the class they are defined in. This is how I’d do it…

[code]Class MyTextField Super TextField

New Event Definition: TextChange()

Event: Sub TextChange()
RaiseEvent TextChange()
End

Method: Protected Sub FireTextChange()
RaiseEvent TextChange()
End

End Class[/code]

Now in subclasses of MyTextField you can trigger the event with FireTextChange.

[quote=44126:@Will Shank]Constructors aren’t events and events can only be raised from the class they are defined in. This is how I’d do it…

[code]Class MyTextField Super TextField

New Event Definition: TextChange()

Event: Sub TextChange()
RaiseEvent TextChange()
End

Method: Protected Sub FireTextChange()
RaiseEvent TextChange()
End

End Class[/code]

Now in subclasses of MyTextField you can trigger the event with FireTextChange.[/quote]
Thanks.

[quote=44126:@Will Shank]Constructors aren’t events and events can only be raised from the class they are defined in. This is how I’d do it…

[code]Class MyTextField Super TextField

New Event Definition: TextChange()

Event: Sub TextChange()
RaiseEvent TextChange()
End

Method: Protected Sub FireTextChange()
RaiseEvent TextChange()
End

End Class[/code]

Now in subclasses of MyTextField you can trigger the event with FireTextChange.[/quote]
I found that I did actually raise the event but I did not raise it in the correct place. So thanks. :wink: