Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / May 2004



Tip: Looking for answers? Try searching our database.

Timer problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jovan - 31 May 2004 16:23 GMT
Does anyone know how to solve this problem? i want that label1 shows the
time that is going from 10 to 0, and when it reaches 0 it shows
msgbox"Over!", but something is wrong. the VB always crushes.

do
a = timer1.interval
label1.caption = a
loop until label1.caption = 0

Please help!
Rick Rothstein - 31 May 2004 16:54 GMT
> Does anyone know how to solve this problem? i want that label1 shows the
> time that is going from 10 to 0, and when it reaches 0 it shows
[quoted text clipped - 4 lines]
> label1.caption = a
> loop until label1.caption = 0

The Timer control is not a count-down timer per se; rather, it is simply
a control that will "fire" (the Timer event will occur) every so often.
You tell it how often to "fire" using its Interval property. The number
you ASSIGN TO the Interval property is the number of milliseconds
between "firings"; so, when you assign the Interval property's value to
your variable 'a' in your code, the same number is being assigned over
and over as the loop continues on indefinitely. Try setting the Interval
property to the number of whatever's (seconds, minutes... you didn't
say) and keep subtracting one from a Static variable inside the event
(or a "global" variable declared in the form's General-Declaration
section) until that variable reaches zero. Be advised, though, the
"firing" of the Timer does not have a high priority; so, if your system
is real busy, it is possible for the Timer to "miss" firing every now
and again. That is, don't count on it being the most accurate timer in
the world.

Rick - MVP
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.