How do you call a Event Handler that is inside a Class

Hi All,

How do you call an event handle from inside a class?

For example, when i press a submit button, i want to action an event handle that is inside a class that has been added to my program….


On your class you would create the Event Handler and do your event handling.
So right-click your myGreatButtonSubclass in the navigator, and add an event handler to it.

Sorry Tim, I’m still not sure what you mean.

(1) Add button to Window
(2) double click button to go to coding area

– The Class is shown on the Main Screen

My Class
- Inside Class --> Event Handles --> Event 1

Where do i add / make reference

If I understand you correctly, you want to make it so that your class will raise an event which is available on the window. If this is correct you will need to use RaiseEvent. A few example which should send you on your way for how to use raise event with different event parameters and return types:

[code]//event is defined as “MyEvent”
RaiseEvent MyEvent

//event is defined as “MyEvent(anInt as integer)”
RaiseEvent MyEvent(someInteger)

//event is defined as “MyEvent as Integer”
dim someInteger as integer = RaiseEvent MyEvent[/code]

Oh I see. I first thought you wanted your button was the class you added.

If you want to be able to Raise the event from outside of the class, you must create a Public Method which includes the RaiseEvent code.

its an important distinction that you Raise an event, but you Call a method. you may only Raise an event from within the owning class.

RaiseEvent does not allow you to raise an event from outside the scope of the class the event is declared in. The keyword exists so that you can raise an event that has the same name as a method, since method invocation has higher priority during name lookup and it’d otherwise be impossible.

Yes, I know it seemed like he was going to be raising the event based on internal actions in his class, and the documentation is also clear on this so I didn’t think it needed any explaining.