|
-
Oct 3rd, 2009, 05:55 AM
#1
Thread Starter
Addicted Member
Timer object
Hello There,
I would like to ask if anybody here know how to stop timer from another class?
let say:I have a timer object started in Class A and I want to stop that timer in Class B..how can i do that?..pls help me.
thank you in advance for all the reply..
glen
-
Oct 3rd, 2009, 07:50 AM
#2
Re: Timer object
Put a Public Sub in ClassA. If ClassA started off as a Form, it may help to add the Shared keyword:
Code:
Public Shared Sub StopTimer
Me.Timer1.Stop
End Sub
When you need to stop the timer, call the sub from ClassB, using the ClassName:
If the sub above gives an error, probably it's because the Timer itself isn't shared. In that case, leave out the Shared keyword. You have to reference the sub through an instance of ClassA:
Code:
Dim myClassA as New ClassA
myClassA.StopTimer
cheers, BB
Last edited by boops boops; Oct 3rd, 2009 at 08:01 AM.
-
Oct 4th, 2009, 07:48 PM
#3
Thread Starter
Addicted Member
Re: Timer object
i give it a try later..thanks
i will post back if it solved my problem..
Last edited by [gja]; Oct 5th, 2009 at 02:46 AM.
-
Oct 4th, 2009, 08:51 PM
#4
Thread Starter
Addicted Member
Re: Timer object
i tried to run my app and the problem still not resolved.
is there any other way to do this?
thanks
Last edited by [gja]; Oct 5th, 2009 at 02:46 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|