|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
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. 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. "guy" <g**@discussions.microsoft.com> schrieb: Better simply call 'System.Threading.Thread.Sleep', which will block > System.Threading.Thread.CurrentThread.Sleep( ) 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/> 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. 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. 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. 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. > > VB6?
The .NET answer had already been posted. I was asking about the OT mentioning VB6. 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 >
filesystem.getfiles question
BackGroundWorker.ProgressChanged "Cross-thread operation not valid" at 2nd/3th/... progress Local Machine policy exceptions control disable byref and byvalue datagrid entry with no db components Looking for graphic controls to use in .NET compiles as a form -- but not as a control Must I change the property in 26 projects or is there a soultion level way of doing it Usual Databinding Question - UNusual Requirements |
|||||||||||||||||||||||