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

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.

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

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?

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.

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.

there's any available delay function in VB 2008?

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

there's any available delay function in VB 2008?

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

solved the case!!

just like what Teme64 suggested but there is one changing :

Threading.Thread.Sleep(ms)

that's all!!

What about

Public Class MyUtils
    Shared Sub Wait(ByVal numSeconds As Long)

        For i = 1 To numSeconds
            Threading.Thread.Sleep(1000)
            Application.DoEvents()
            Application.RaiseIdle(New System.EventArgs)
        Next

    End Sub

End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.