473,499 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 109365
* "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
2151
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
19359
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
1299
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
3229
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
2904
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
5350
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
9718
by: Ricardo | last post by:
Hi wizards, How can I make my VB .NET program sleep for 5 seconds . Thanks in advance.
19
3972
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
3356
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
7009
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7178
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7223
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7390
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4602
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3103
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.