VB.NET - Process Wait for 10 seconds in Vb.net

Asked By Eswaran Radhakrishnan on 01-Jul-08 12:10 PM

Hi all,

I have function and that is going to do some calculations. I need to call this function when I click the button. After I clik the button I need to wait the process for 10 seconds in the function. After the 10 seconds only i need to do the calculation.

How I can do that in vb.net?

Thanks

R. Eswaran

Solution

Sakshi a replied to Eswaran Radhakrishnan on 01-Jul-08 12:50 PM

put the following line

System.Threading.Thread.Sleep(1000)

reply

alice johnson replied to Eswaran Radhakrishnan on 02-Jul-08 01:05 AM
Hi friend you can acheive this by making use of the threads in yuor program.
Firstly giv this
Using Sytem.Threading;

then make the thread to sleep by calling the Thread.sleep(1000);

else  wrtie theis code:
System.Threading.thread.sleep(1000);
hope it helps.

Try this

Sagar P replied to Eswaran Radhakrishnan on 02-Jul-08 01:56 AM

You have to use Treading for that like;

Using Sytem.Threading;

Thread.sleep(10000);

This will wait the process for 10 seconds in the function

or do it directly like;

System.Threading.Thread.Sleep(1000);

Best Luck!!!!!!!!!!!!!!!
Sujit.

sean replied to Eswaran Radhakrishnan on 11-Aug-10 05:48 AM
Hey I came across this Pause/ Wait script and thought I would share

Sub Delay(ByVal dblSecs As Double)

Const OneSec As Double = 1.0# / (1440.0# * 60.0#)
Dim dblWaitTil As Date
Now.AddSeconds(OneSec)
dblWaitTil = Now.AddSeconds(OneSec).AddSeconds(dblSecs)
Do Until Now > dblWaitTil
Application.DoEvents() ' Allow windows messages to be processed
Loop

End Sub

Then just     Call Delay(10)

where you want the pause
Henri replied to sean on 04-Oct-10 01:47 PM

Tanks man! very good idéa!

small and effective code
Kannan replied to Eswaran Radhakrishnan on 05-Jul-11 09:13 AM
Hi,

Could you pls explain your code in detail?

thanks
KG