Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

Need a timer on VB6

I have a function debugged and working.  Now I need to call it every 5 (or so) seconds.

Could someone please show me the code I need for this?  If will run 24/7, so please consider robustness, etc.

It's VB 6.0.


thanks,
newbieweb

ASKER CERTIFIED SOLUTION
Avatar of AkisC
AkisC
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if your function takes more than 5 sec to complete then consider...

Private Sub Timer1_Timer()
    Me.Timer1.Enabled = False
    Call YourFunction
    Me.Timer1.Enabled = True
End Sub
Avatar of curiouswebster

ASKER

I'm pretty new to VB.

Do I define Timer1 somewhere?

I see that "Me" is known by the environment, but not Timer1.

From the tool box select the timer control and then drop it on your form
The timer control is the one with a clock icon
Click on it. The cursor changes to a cross... then draw a squaere on your form. That drops the timer on your form
If you do not see the toolbox (to your left) then click on the View menu of VB6 and from the drop down menu click toolbox. You may also hit Alt+vx sortcut for the toolbox to appear
How do I switch to the form layout window?
I got it.  Thanks.
The Load() function is not getting called.

Do I need to do more than just create the code for it?
It works just like Visual Studio C#.

I double clicked the Form and it got created.

Thanks