PDA

Click to See Complete Forum and Search --> : Timer Event


WaaX
Feb 19th, 2001, 01:04 PM
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

simonm
Feb 20th, 2001, 09:47 AM
I think you need to declare 'timer1' with events like this:

Dim WithEvents timer1 AS Timer

WaaX
Feb 20th, 2001, 01:15 PM
Oh yeah! Thx

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

Thx again.

Wald
Feb 23rd, 2001, 04:45 AM
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

wolfofthenorth
Mar 4th, 2001, 11:41 AM
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.

simonm
Mar 5th, 2001, 05:34 AM
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.

wolfofthenorth
Mar 5th, 2001, 01:07 PM
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.

simonm
Mar 6th, 2001, 04:22 AM
I still don't understand why you need a 'new' timer object.

Just use the timer object without instantiating it.

wolfofthenorth
Mar 6th, 2001, 01:31 PM
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!!!

wolfofthenorth
Mar 7th, 2001, 11:23 AM
Thanks for the help!!