Hi guys......
My problem is....
If we write some lines of code in button click event......
How to set the sleeping timer
means.....
For eg----
Suppose we wrote 10 line of code in button click event....
After the exicution of first 5 lines of code,,, remaining 5 lines of code should be exicute after 5 seconds of first 5 lines of exicution....
How can i do that......
Somebdy plz help me
our school project is struck in the middle.......
Plz help me

Recommended Answers

All 4 Replies

u can use Thread.

Threading.Thread.Sleep(5000)

Just wondering; do the lines have to be in the Button's.Click event or can they be in separate Subs?as:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        someCoolSub()
        someOtherCoolSub()
    End Sub
    Private Sub someCoolSub()
        MsgBox("someCoolSub")
    End Sub
    Private Sub someOtherCoolSub()
        MsgBox("someOtherCoolSub")
    End Sub

Reason I'm asking is because you can use the Threading.Thread.Sleep , although that will freeze your entire application for 5 seconds, not just pause the the time between running the rest of the lines of code.

thx for help......
bt i tried....
i cant use threadding.thread.sleep()
bcz its not working in button click event

thx for help frnds.......

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.