472,989 Members | 3,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,989 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 109124
* "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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Brian Roberts | last post by:
I have a command line Python program that sometimes takes a bit (several minutes) to run. I want to provide an optional method for an impatient user (me!) to check the status of the program. The...
4
by: Alexander Erlich | last post by:
Hello, I have written a function that returns a random number in dependence of the time running on the current system. The problem is that initializing two variables with this function _one...
2
by: John Salerno | last post by:
Ok, I made some changes and want to see what you guys think, as far as syntax and logic, etc. What I want it to do is show the number of minutes remaining each minute, and then beep at the end. Is...
18
by: Max | last post by:
This is a follow-up on my previous thread concerning having the program wait for a certain date and time and then executing some code when it gets there. My question is; can I use the Sleep...
4
by: Fred Nelson | last post by:
Hi: I'm trying to write a routine that will permit my VB.NET program to pause execution for five minutes and try a task again if there is a failure. After a set number of tries it should return...
10
by: moti | last post by:
I need to check for the existence of a file (the filename and folder are known). The file may be created at any time, before or after the start of the file check. As I do not want to burden the...
1
by: Ricardo | last post by:
Hi wizards, How can I make my VB .NET program sleep for 5 seconds . Thanks in advance.
19
by: dave.zoltan | last post by:
Hi everybody, I am awfully new to programming in C and all I have had to work with so far have been tutorials that I've found online. In my searching, however, I have not found a solution to a...
4
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, We use Payflow Pro from Verisign(Now it calls paypal Payflow Pro) as a gateway software to process credit card payment. Most of time, Paypal server is OK and we don't have problems for...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.