Real Software Forums

RaiseEvent usage
Page 1 of 1

Author:  ehumail [ Mon Mar 04, 2013 3:20 am ]
Post subject:  RaiseEvent usage


I have a subclass of a Serial class named SER. In the SER subclass I declared a Timer (tTimer) and a public method (Open) for the SER.
And I declared a tTimer_Action(Sender As Timer) method for the Timer.

So in the Open method I init:
tTimer = new Timer
tTimer.Period = 500
tTimer.Mode = 0
Addhandler tTimer.Action, AddressOf tTimer_Action

In addition I declared a TimerAction event in a SER subclass, like:

Sub tTimer_Action(Sender As Timer)

//do something...
Dim x As Integer = 0

RaiseEvent TimerAction

End Sub

My problem is the Raiseevent do not work. If I add a breakpoint inside the tTimer_Action method before the RaiseEvent, everything is OK BUT the TimerAction event won't called...

What is the problem? I missed something?

Author:  timhare [ Mon Mar 04, 2013 3:37 am ]
Post subject:  Re: RaiseEvent usage

RaiseEvent calls the event in a subclass of SER. Events are called by the Super, not by the class itself. If you put an instance of SER on the window and put code in the TimerAction event in the window's code editor, then that code would execute. Or if you create another class and make its Super SER, and fill out code in the TimerAction event handler, it would execute. But RaiseEvent in SER does not execute code in SER. Only in a subclass/instance of SER.

Author:  ehumail [ Mon Mar 04, 2013 3:41 am ]
Post subject:  Re: RaiseEvent usage

Ok, thank You for the quick reply! It works!

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group