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

delay

P: n/a
hi, i have a program that will execute printing with delay. the last time i
posted a question on how to introduced delay to my program, i believe i given
an advice on using the following...

Threading.Thread.Sleep(11000)

it work fine, but i do want to introduce a "cancel" function in my program
so that my program can stop anytime i want, but with the above command, the
program will hang for 11sec as shown and during this 11sec, no command can be
entered...how can i solve this?
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Newbie,

(When you use a normal name it is easier to react on previous messages from
you).

\\\
for i as integer = 1 to 11
threading.thread.sleep(i * 1000)
application.doevents
next
///

I hope this helps,

Cor
Nov 21 '05 #2

P: n/a
"Cor Ligthert" <no************@planet.nl> schrieb:
(When you use a normal name it is easier to react on previous messages
from you).

\\\
for i as integer = 1 to 11
threading.thread.sleep(i * 1000)
application.doevents
next
///


\\\
Private m_Cancel As Boolean
..
..
..
Private Sub Button1_Click(...)...
m_Cancel = True
End Sub
..
..
..
For i As Integer = 1 To 11
Thread.Sleep(1000)
Application.DoEvents()
If m_Cancel Then Exit For
Next i
///

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

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.