[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Simple Timing Question

Posted on 2006-11-24
2
Medium Priority
?
165 Views
Last Modified: 2010-04-30
I  have a short procedure that needs to run every x seconds, where x ranges anywhere from 1 to 100,000.  The logic is something like:

*** pseudo code ***
When  TimeSinceLastRun reaches x seconds
    procedure()
    TimeSinceLastRun = 0
Start again
*** end *****


The simple idea is to run the procedure every x seconds.  I just don't know how to code it.

I noticed in VG an object called a Timer, but I don't know how it works.

As always, any light shed on this will be appreciated and recognized with points.
0
Comment
Question by:Danimal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Author Comment

by:Danimal
ID: 18010499
^^^correction, in VB, not VG, I found the Timer object.
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 140 total points
ID: 18010646
Put a timer control on your form and add some code like this


Sub Form_Load()
Dim s as integer
s = 3 'seconds

Timer1.Interval = s*1000 'timer interval is in millisecond units
Timer1.Enabled = True
End Sub

Sub Timer1_Timer()
      procedure()
End Sub
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question