By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,290 Members | 1,263 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,290 IT Pros & Developers. It's quick & easy.

time delay

P: n/a
I'm to delay my program for some limited time...i try using the following
codes but it doesn't work, how do i do a time delay???

'Extracted from the main function
Timer11.Start()
Do

tCC = timeCount
Loop Until timeCount > 10000

Timer11.Stop()
'End of the extraction
Private Sub Timer11_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer11.Tick

timeCounter()

End Sub

Private Sub timeCounter()
timeCount = timeCount + 1
End Sub
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"notregister" <no*********@discussions.microsoft.com> schrieb:
I'm to delay my program for some limited time...i try using the following
codes but it doesn't work, how do i do a time delay???


Set the timer's 'Interval' property to 10000 instead of letting the timer
tick 10000 times.

- or -

\\\
System.Threading.Thread.Sleep(10000)
///

Notice that this approach will block the thread for 10000. If you call this
method in your app's UI thread, the user won't be able to interact with your
application's user interface in this time.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2

P: n/a
NotRegister,

Notice that your function eats process time.

The function Herfried shows you with the thread waid, has the advantage that
it blocks your screen untill all is done in the routine and get therefore no
dependency errors.

I hope this helps,

Cor
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.