471,084 Members | 1,046 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,084 software developers and data experts.

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

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
8 108343
* "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
"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
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
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
* "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
"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
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
* "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.

Similar topics

9 posts views Thread by Brian Roberts | last post: by
4 posts views Thread by Alexander Erlich | last post: by
2 posts views Thread by John Salerno | last post: by
4 posts views Thread by Fred Nelson | last post: by
1 post views Thread by Ricardo | last post: by
19 posts views Thread by dave.zoltan | last post: by
4 posts views Thread by =?Utf-8?B?YzY3NjIyOA==?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.