Home All Groups Group Topic Archive Search About
Author
13 Feb 2006 2:51 PM
HockeyFan
I'm new to VB.Net.  Wondering how you do a sleep for x milliseconds and then
continue executing on the next line?  This was done in VB6 and wondering how
it's done in VB.Net.

Author
13 Feb 2006 3:00 PM
guy
look at:-
System.Threading.Thread.CurrentThread.Sleep( )

hth

--guy--

Show quoteHide quote
"HockeyFan" wrote:

> I'm new to VB.Net.  Wondering how you do a sleep for x milliseconds and then
> continue executing on the next line?  This was done in VB6 and wondering how
> it's done in VB.Net.
Author
13 Feb 2006 7:33 PM
Herfried K. Wagner [MVP]
"guy" <g**@discussions.microsoft.com> schrieb:
> System.Threading.Thread.CurrentThread.Sleep( )

Better simply call 'System.Threading.Thread.Sleep', which will block
execution of the thread calling the method.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
13 Feb 2006 3:01 PM
zacks
System.Threading

Imports System.Threading

public sub mySub

'do something before waiting
Thread.Sleep(2000) ' sleeps for 2000 milliseconds
'do something after waiting

end sub

Can get you in trouble if you have multiple threads unless you are
careful.
Author
13 Feb 2006 9:22 PM
CMM
I don't remember this being available in VB6?!
I know you could do it using the Win32 Sleep API... but it wasn't part of
VB6.

--
-C. Moya
www.cmoya.com
Show quoteHide quote
"HockeyFan" <Hockey***@discussions.microsoft.com> wrote in message
news:DDCA6E0A-0B81-4A8C-8D30-251002520372@microsoft.com...
> I'm new to VB.Net.  Wondering how you do a sleep for x milliseconds and
> then
> continue executing on the next line?  This was done in VB6 and wondering
> how
> it's done in VB.Net.
Author
15 Feb 2006 12:17 PM
m.posseth
Imports System

Public Module modmain

Sub Main()

Console.WriteLine("I wait five seconds")

System.Threading.Thread.Sleep(5000)

Console.WriteLine("five seconds have passed")

End Sub

End Module





regards



Michel Posseth [MCP]









Show quoteHide quote
"CMM" <cmm@nospam.com> wrote in message
news:%232MXUOOMGHA.2064@TK2MSFTNGP09.phx.gbl...
>I don't remember this being available in VB6?!
> I know you could do it using the Win32 Sleep API... but it wasn't part of
> VB6.
>
> --
> -C. Moya
> www.cmoya.com
> "HockeyFan" <Hockey***@discussions.microsoft.com> wrote in message
> news:DDCA6E0A-0B81-4A8C-8D30-251002520372@microsoft.com...
>> I'm new to VB.Net.  Wondering how you do a sleep for x milliseconds and
>> then
>> continue executing on the next line?  This was done in VB6 and wondering
>> how
>> it's done in VB.Net.
>
>
Author
15 Feb 2006 12:41 PM
CMM
VB6?

The .NET answer had already been posted. I was asking about the OT
mentioning VB6.

--
-C. Moya
www.cmoya.com
Author
15 Feb 2006 7:25 PM
m.posseth
well in my newsgroup reader the .Net answer wasn`t showed i see now that
this was on a seperate thread


about the vb6 thingy

afaik this can only be done like this

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Command1_Click()



Me.Caption = "Your system will sleep 5 sec."

'Sleep for 5000 milliseconds

Sleep 5000

Me.Caption = ""

End Sub

Private Sub Form_Load()

Me.Caption = ""

Command1.Caption = "Sleep ..."

End Sub

regards

Michel Posseth [MCP]
Show quoteHide quote
"CMM" <cmm@nospam.com> wrote in message
news:ODYaz0iMGHA.1832@TK2MSFTNGP11.phx.gbl...
> VB6?
>
> The .NET answer had already been posted. I was asking about the OT
> mentioning VB6.
>
> --
> -C. Moya
> www.cmoya.com
>