Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Workings over time..
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Remm




PostPosted: Sun Oct 08, 2006 9:14 am   Post subject: Workings over time..

How would I make it so that a number in a label / textbox will decrease every half a second no matter what you're doing..? Thanks!
Sponsor
Sponsor
Sponsor
sponsor
cool dude




PostPosted: Sun Oct 08, 2006 11:13 am   Post subject: (No subject)

you have several choices. first choice make a loop but not that efficient. second choice use a timer. third and easiest choice would be to use the timer module that i showed here: http://www.compsci.ca/v2/viewtopic.php?t=13600
NikG




PostPosted: Sun Oct 08, 2006 5:39 pm   Post subject: (No subject)

cool dude, that link sends you to a page where you mentions the sleep function... not very useful here.

The timer control is the way to go. Just put the number reduction code in the Timer1_Timer sub.
cool dude




PostPosted: Sun Oct 08, 2006 9:20 pm   Post subject: (No subject)

NikG wrote:
cool dude, that link sends you to a page where you mentions the sleep function... not very useful here.

The timer control is the way to go. Just put the number reduction code in the Timer1_Timer sub.


hmm... do you know exactly how the sleep function works? you can easily put it in a loop so that it will decrease the number in the label box every half a second. if you want to use a timer you can as well, and i mentioned that, but this way works to.
Silent Avenger




PostPosted: Mon Oct 09, 2006 9:36 am   Post subject: (No subject)

I suggest if your making a fairly small program that doesn't need a whole lot of accuracy use the timer but if you need a fair amount of acuracy I think the sleep function is a better way to go.
NikG




PostPosted: Mon Oct 09, 2006 10:11 pm   Post subject: (No subject)

cool dude wrote:
hmm... do you know exactly how the sleep function works? you can easily put it in a loop so that it will decrease the number in the label box every half a second. if you want to use a timer you can as well, and i mentioned that, but this way works to.
Go reread your orig post.
cool dude wrote:
third and easiest choice would be to use the timer module that i showed here: ...
I got confused because the link goes to your SLEEP function, not TIMER MODULE.

But in any case, doesn't that other post mention that sleep pauses your entire program? If that's not the problem then fine... but if you want to continue using the vb prog while the timer is counting down (which is what I would want), then sleep is not a good solution! And frankly, I'd really wonder if sleep is indeed better than timer.
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: