Results 1 to 5 of 5

Thread: timer

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Posts
    283

    timer

    how do i create a timer within a class during runtime when the user clicks a button? I want the tick sub to be in the class if possible? so basically, can you add a timer to something other than a form?

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Yes.

    VB Code:
    1. Dim x As New Timer
    2. AddHandler x.Tick, AddressOf mytickhandlingsub
    3.  
    4. Private Sub mytickhandlingsub(ByVal sender As Object, ByVal e As System.EventArgs)
    5.         'do your stuff here
    6.     End Sub

  3. #3

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Posts
    283
    thanks. that works. is there a way to pass arguments to the tick function though? thanks again.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Tick is not a function its an event and so you can't really pass arguments to it. It gets raised by the timer object itself so only the timer itself passes any arguments to it.

  5. #5

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Posts
    283
    yeah. i figured that, but thanks for clarifying.

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