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

How can I make my VB .Net program sleep for 5 minutes?

P: n/a
How can I make my VB .net program sleep or pause for say 5 minutes?

Any help would be much appreciated.

Roger
Nov 21 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
* "Roger Solano" <rs*****@cobeca.com> scripsit:
How can I make my VB .net program sleep or pause for say 5 minutes?


'System.Threading.Thread.Sleep(5000)'.

--
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
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
* "Roger Solano" <rs*****@cobeca.com> scripsit:
How can I make my VB .net program sleep or pause for say 5 minutes?


'System.Threading.Thread.Sleep(5000)'.


I think it's in milliseconds so 5 minutes would be
'System.Threading.Thread.Sleep(300000)' 'three hundred thousand ms.
Nov 21 '05 #3

P: n/a
Ricky

I think it's in milliseconds so 5 minutes would be
'System.Threading.Thread.Sleep(300000)' 'three hundred thousand ms.


You know how fast Herfried is he post in a second what another does in a
minute.

:-)

Cor
Nov 21 '05 #4

P: n/a
Roger,

In additon to the others,

When you do this than mostly is adviced to use a timer or to use a different
thread. Because your program stops completly and your user cannot even
cancel it in a normal way.

An easy way to prevent that freezing is
For i = 1 to 300
threading.thread.sleep(i * 1000)
application.doevents
next
How can I make my VB .net program sleep or pause for say 5 minutes?

Any help would be much appreciated.

Roger

Nov 21 '05 #5

P: n/a
* "Ricky W. Hunt" <rh*****@hotmail.com> scripsit:
How can I make my VB .net program sleep or pause for say 5 minutes?


'System.Threading.Thread.Sleep(5000)'.


I think it's in milliseconds so 5 minutes would be
'System.Threading.Thread.Sleep(300000)' 'three hundred thousand ms.


Ooops. I mixed up 5 minutes with 5 seconds...

--
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 #6

P: n/a
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ew**************@TK2MSFTNGP11.phx.gbl...
* "Ricky W. Hunt" <rh*****@hotmail.com> scripsit:
How can I make my VB .net program sleep or pause for say 5 minutes?

'System.Threading.Thread.Sleep(5000)'.


I think it's in milliseconds so 5 minutes would be
'System.Threading.Thread.Sleep(300000)' 'three hundred thousand ms.


Ooops. I mixed up 5 minutes with 5 seconds...


Herfried, what does a program actually "do" during this sleep time? Is it
consuming any resources other than memory?
Nov 21 '05 #7

P: n/a
I wrote this, maybe make 50 more... like 100 or so

Sub Pause(ByVal pmTimeToPause As Double)

Dim iIndex As Int16
For iIndex = 1 To pmTimeToPause / 50
If g_bEnd = True Then Exit Sub

System.Threading.Thread.CurrentThread.Sleep(50)
Application.DoEvents()

Next

End Sub

1 1

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #8

P: n/a
* "Ricky W. Hunt" <rh*****@hotmail.com> scripsit:
> How can I make my VB .net program sleep or pause for say 5 minutes?

'System.Threading.Thread.Sleep(5000)'.

I think it's in milliseconds so 5 minutes would be
'System.Threading.Thread.Sleep(300000)' 'three hundred thousand ms.


Ooops. I mixed up 5 minutes with 5 seconds...


Herfried, what does a program actually "do" during this sleep time? Is it
consuming any resources other than memory?


It still uses its resources, but it doesn't get any processor time. So
the UI will be "locked" 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 #9

This discussion thread is closed

Replies have been disabled for this discussion.