954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

To put delay in vb.net

Anybody please help me to put delay in vb.net without freezing form

nav010
Newbie Poster
10 posts since Sep 2008
Reputation Points: 10
Solved Threads: 0
 

If you use a short delay, user won't notice any freezing.

Threading.Thread.CurrentThread.Sleep(1000)

and the parameter is in milliseconds. Above code causes one second delay.

Teme64
Veteran Poster
1,031 posts since Aug 2008
Reputation Points: 218
Solved Threads: 203
 

This does not work out. Please suggest any other solution.

nav010
Newbie Poster
10 posts since Sep 2008
Reputation Points: 10
Solved Threads: 0
 

Ok. Give more details, what do you exactly want to delay. Delay execution in a form? Delay execution in a class module and have still responsive UI? Delay the time before user can press a specific button but can press other buttons? Or what kind of scenario you have?

Teme64
Veteran Poster
1,031 posts since Aug 2008
Reputation Points: 218
Solved Threads: 203
 

If you have a situation where you want to disable some controls in a form for a specific time, disable them, start Timer-control for a specific interval and in the Timer_Tick event enable controls.

Teme64
Veteran Poster
1,031 posts since Aug 2008
Reputation Points: 218
Solved Threads: 203
 

other suggestion use timer.
question for u :
why teme64 suggestion with sleep() function doesn't work for u? cause i think is better to use sleep than timer control.

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

there's any available delay function in VB 2008?

for example, delay one second between each For Loop executing.

realheaven
Newbie Poster
6 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

there's any available delay function in VB 2008?

for example, delay one second between each For Loop executing.

realheaven
Newbie Poster
6 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

solved the case!!

just like what Teme64 suggested but there is one changing :

Threading.Thread.Sleep(ms)

that's all!!

realheaven
Newbie Poster
6 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You