Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 25th, 2007, 09:32 AM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to VlaHD
Default Need Help! Please help me!

How i can do in my vb application to repet an action at interval of 3 minutes ??
I was used the timer, but the max interval of the timer is 65 seconds.

Please help me!
 
Old March 26th, 2007, 06:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...

just use a timer and a variable that count how many times did the timer fires, when you count 3 do your stuff and reset that variable to 0...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
 
Old March 26th, 2007, 10:28 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Using a timer for extended periods is as Gonzalon says.

However, make sure your variable is static if it is declared within your timer event handler.
Otherwise, declare your variable at the form level.

Woody Z
http://www.learntoprogramnow.com
How to use a forum to help solve problems
 
Old March 26th, 2007, 12:18 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

and if you don't want to use a variable, you can still use the Tag property of the timer

myTimer.Inteval = 30000 '' half a sec
myTimer.Tag = 0
myTimer.Enabled = true

and in the onTimer event

myTimer.Enalbled = false
myTimer.Tag = myTimer.Tag + 1
if myTimer.Tag = 6 then
'' call your method
else
myTimer.Enabled = true
endif

"There are two ways to write error-free programs. Only the third one works."
Unknown
 
Old March 26th, 2007, 02:48 PM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to VlaHD
Default

Thanks!

When The Hell Is Full The Dead People Will Walk The Streets Of Earth. :p









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.