Results 1 to 10 of 10

Thread: Timer Event

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    6

    Question

    Hi,
    I'm creating a DLL that's going to be called from IIS. The DLL going to check to an Access database if there is new entry. If so its going to update another page.
    I want a Timer that's call the Update function every ex: 5 min. (5000)
    I try something like this:

    (General Statement)
    Dim timer1 as Timer

    Private Sub Class_Initialize()
    timerInterval.Interval = 5000
    timerInterval.Enabled = True
    End Sub

    Sub Timer1_Timer()
    Call Update
    End Sub

    Sub Update()
    ..... Code ....
    End sub

    Nothing seem to happen, where img doing wrong?

    Thx

  2. #2
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Lightbulb WithEvents

    I think you need to declare 'timer1' with events like this:

    Dim WithEvents timer1 AS Timer

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    6

    Smile

    Oh yeah! Thx

    I didnt played with event too much, but now i know

    Thx again.

  4. #4
    New Member
    Join Date
    Feb 2001
    Posts
    2

    Leef de call

    Just leef de call away
    You only need the naam of the sub or function

    Sub Timer1_Timer()
    Update
    End Sub

    Sub Update()
    ..... Code ....
    End sub

    Like This, maybe it wil be ok
    greatings from Wald

  5. #5
    Addicted Member wolfofthenorth's Avatar
    Join Date
    Jan 2001
    Location
    Tatooine
    Posts
    169

    Talking

    This may seem like a stupid question, but here goes...

    How do you set the timer1 object to a new timer? I can dim as timer, but not as new timer. If you use createobject, what goes in the quotes, or what dll must be referenced to do this?

    Thanks.
    That which does not kill us, only makes us stronger.

  6. #6
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Post NEW keyword

    If you don't see the Timer object in the object browser list after typing the NEW keyword, you can't instantiate it by any means. It is not 'creatable'.

    Why do you need a new Timer object anyway? More than one timer will all have the same value anyway.

  7. #7
    Addicted Member wolfofthenorth's Avatar
    Join Date
    Jan 2001
    Location
    Tatooine
    Posts
    169
    I wanted to create a timer in code, in an ActiveX exe. I didnt want to have to put a form in the project and just use it for the timer event.

    The Settimer API won't work on NT (for me, anyway).

    If you have any suggestions about the best way to do this, I an very eager to hear them.

    Thanks.
    That which does not kill us, only makes us stronger.

  8. #8
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Question Why New?

    I still don't understand why you need a 'new' timer object.

    Just use the timer object without instantiating it.

  9. #9
    Addicted Member wolfofthenorth's Avatar
    Join Date
    Jan 2001
    Location
    Tatooine
    Posts
    169

    Talking

    Could you post some code showing how to set the properties and recieve a timer event in a project that doesnt have a form? This may seem like a stupid question, but I am having trouble setting the properties from an object I can't instanciate. For Instance...

    (This is what im trying)
    Dim tm as timer
    or
    dim withevents tm as timer

    tm.interval=1000 or tm.enabled=true

    The last line blows up because the object isnt set. An since I dont have a timer on a form to actually set the interval and enabled properties I am at a loss. I'm sure there must be an easy way to do this, but I dont know it. Thanks for your help!!!
    That which does not kill us, only makes us stronger.

  10. #10
    Addicted Member wolfofthenorth's Avatar
    Join Date
    Jan 2001
    Location
    Tatooine
    Posts
    169

    Smile

    Thanks for the help!!
    That which does not kill us, only makes us stronger.

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