PC Review


Reply
Thread Tools Rate Thread

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

 
 
Roger Solano
Guest
Posts: n/a
 
      31st Aug 2004
How can I make my VB .net program sleep or pause for say 5 minutes?

Any help would be much appreciated.

Roger


 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      1st Sep 2004
* "Roger Solano" <(E-Mail Removed)> 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/>
 
Reply With Quote
 
Ricky W. Hunt
Guest
Posts: n/a
 
      1st Sep 2004
"Herfried K. Wagner [MVP]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> * "Roger Solano" <(E-Mail Removed)> 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.


 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      1st Sep 2004
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


 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      1st Sep 2004
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
>
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      1st Sep 2004
* "Ricky W. Hunt" <(E-Mail Removed)> 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/>
 
Reply With Quote
 
Ricky W. Hunt
Guest
Posts: n/a
 
      1st Sep 2004
"Herfried K. Wagner [MVP]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> * "Ricky W. Hunt" <(E-Mail Removed)> 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?


 
Reply With Quote
 
_IS_ -
Guest
Posts: n/a
 
      1st Sep 2004
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!
 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      1st Sep 2004
* "Ricky W. Hunt" <(E-Mail Removed)> 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/>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista HP goes into sleep mode every few minutes... Daniel Windows Vista Performance 0 6th Jun 2008 06:42 PM
WoW freezes a few minutes after Vista awakes from sleep =?Utf-8?B?Um9ja3lTcXVpcnJlbA==?= Windows Vista General Discussion 4 31st Oct 2007 01:12 PM
Make application sleep Morten Snedker Microsoft VB .NET 12 13th Oct 2006 11:27 PM
computer goes to sleep with 34 minutes remaining in setup Windows XP Setup 2 8th Jun 2004 04:01 PM
Sleep Program? Ryan Windows XP General 0 17th Sep 2003 06:13 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:49 PM.