VB.Net : Pausing the Program momentarily

Started by
1 comment, last by ItsDan 16 years, 5 months ago
hey all, I was wondering how you can program a game so that after it executes a function it waits for a second or two before it moves onto its next function? for example if i were programming a label to have text in it after a triggered event, have it wait one second before it displays some more text within it replacing the old text. because i dont know how to do this it is just displaying the last text set because of the speed of the program. Does anyone know how i can pause my program momentarily? Thanks
The wheel is spinning, but the hampster is dead!
Advertisement
You could use a Timer component. When you set the text, start the timer, and when the timer's Tick event fires, do whatever you want to do next.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

Yes a Timer (either the timer control or the timer class) would be the easiest, otherwise you'd be getting into threading. Drop a timer control onto your winform and set Enabled to true, and the interval to 1000 (interval is in 1/1000th of a second, so 1000/1000 is 1 second). Then put your code in the timer's Tick event.
-----------------------------------------------“The best, most affordable way to save the most lives and improve overall health is to increase the number of trained local, primary healthcare workers.”Learn how you can help at www.ghets.org

This topic is closed to new replies.

Advertisement