Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I have a Timer control with more than 120000 msec?

Status
Not open for further replies.

marabozu

Programmer
Jan 3, 2001
36
US
I'm making a periodic program and I want 5 minutes of interval. The timer control only gives 120000 mseconds! How can I solve this problem?
I've tried with this code:
Start = Timer ' Set start time.
PauseTime = 300
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
But using this code, when he's looping, causes an increse of the CPU usage to 100%. I want one code that reduce CPU usage.
Thank you
 

Hi Marabozu - I had a similar situation. I needed to refresh the screen at certain intervals, allowing the user to be able to change the refresh interval (in minutes of 1, 5 , 15 etc) from a list box.

I created the timer control with 60000 (60 secs) interval...
Then in pgm I simply increment a counter each time the timer event fires; if the counter is = to the &quot;refresh interval&quot;, then I execute the code (in thiis case I then refresh the screen).

Hopes this helps you with your problem. John


Dim strRefreshMinutes As String
gblRefreshMinutes = 15 'data display will refresh every 15 mins
gblMinuteCtr = 0

Private Sub lstRefreshMinutes_Click()

strRefreshMinutes = lstRefreshMinutes.Text

gblRefreshMinutes = Val(strRefreshMinutes)
frmDoorStatuses.Caption = &quot; Door Statuses: *** Automatically refreshes every &quot; &amp; gblRefreshMinutes &amp; &quot; minute(s) *** &quot;

lstRefreshMinutes.Visible = False

End Sub

Private Sub tmrRefresh_Timer()

'Execute the automatic Data refresh at the interval specified
'gblMinuteCtr is the number of minutes since the last Refresh

gblMinuteCtr = gblMinuteCtr + 1

If gblMinuteCtr >= gblRefreshMinutes Then

cmdRefresh_Click

End If

End Sub
 
Hi JonhBates,

That's a very good idea! Later on I'll try it. Thank you for your colaboration
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top