|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Imposing a delay in code executionHi,
Is there a "light" way on CPU usage to delay a process in the code execution. For example, if I want a function to wait 5 seconds before continue executing without using a timer. Is there a better way than using this: While (MyCondition is true) System.Windows.Forms.Application.DoEvents() End While Thanks, Marty Use the Thread.Sleep method.
"Marty" <xmart***@hotmail.com> wrote in message news:FSg3e.107325$KI2.52988@clgrps12...Show quoteHide quote > Hi, > > Is there a "light" way on CPU usage to delay a process in the code > execution. For example, if I want a function to wait 5 seconds before > continue executing without using a timer. > > Is there a better way than using this: > While (MyCondition is true) > System.Windows.Forms.Application.DoEvents() > End While > > Thanks, > Marty Great,
that's really nice :) Marty Marina wrote: Show quoteHide quote > Use the Thread.Sleep method. > > "Marty" <xmart***@hotmail.com> wrote in message > news:FSg3e.107325$KI2.52988@clgrps12... > >>Hi, >> >>Is there a "light" way on CPU usage to delay a process in the code >>execution. For example, if I want a function to wait 5 seconds before >>continue executing without using a timer. >> >>Is there a better way than using this: >>While (MyCondition is true) >>System.Windows.Forms.Application.DoEvents() >>End While >> >>Thanks, >>Marty > > > "Marty" <xmart***@hotmail.com> schrieb: 'System.Threading.Thread.Sleep(<number of milliseconds>)' will block the > Is there a "light" way on CPU usage to delay a process in the code > execution. For example, if I want a function to wait 5 seconds before > continue executing without using a timer. > > Is there a better way than using this: > While (MyCondition is true) > System.Windows.Forms.Application.DoEvents() > End While currently executing thread. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
sorting files retrieved by OpenFileDialog
Total seconds of day VB.Net Joining Paradox and SQL Server Table? MDI Child Form ? Using Comm dll file in vb.net 2003 error Insert Border around a picture Read private variables between forms touch screen monitors Terminating a thread Resize Tab control when windows form resizes |
|||||||||||||||||||||||