Results 1 to 4 of 4

Thread: Timer object

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2009
    Posts
    135

    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

  2. #2
    PowerPoster boops boops's Avatar
    Join Date
    Nov 2008
    Location
    Holland/France
    Posts
    3,201

    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:
    Code:
    ClassA.StopTimer
    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.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2009
    Posts
    135

    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.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2009
    Posts
    135

    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
  •  



Click Here to Expand Forum to Full Width