Adding wait times;Delays pauses ect.
How do you add Delays, Pauses
I am asking is there a way to say this
If Textbox1.Text = "hi" Then
[Adding delay here]
Msgbox("Displaying here")
Additional information.. Is there a way for me too add a delay with a If statement as shown above. Like making it count to 5 seconds or ect. before running the next line of code. I would really appreciate anything other then Timer's because those are very finicky and don't apply updates. I would prefer anything other then a ordinary timer. Thanks for all your support and feedback, It's invaluable.
Re: Adding wait times;Delays pauses ect.
[Sits back, opens the popcorn, waits for the fun to begin!] :cool:
Re: Adding wait times;Delays pauses ect.
Thread.Sleep(5000) pauses for 5 seconds before continuing execution.
Re: Adding wait times;Delays pauses ect.
I hope your having fun ;P
Re: Adding wait times;Delays pauses ect.
Does this Freeze the Form?
Re: Adding wait times;Delays pauses ect.
Quote:
Originally Posted by
Reapism
Does this Freeze the Form?
Oh yes. And it won't work on the main thread unless you import System.Threading!
Re: Adding wait times;Delays pauses ect.
o okay thanks! Wait is there another way I could do this that doesn't Freeze the form. It looks un-professional :(
Re: Adding wait times;Delays pauses ect.
How do you import it doesnt let me "Where do I write this" and Thread.sleep is not even there.
Re: Adding wait times;Delays pauses ect.
Hello everyone. I have no clue how to import the System.Threading and it wont go above the Public class. Is there any sort of way I can do this with the same functionallity without making the form freeze but if not Can you please let me know where to import in Visual Studio 2010
Re: Adding wait times;Delays pauses ect.
vb.net Code:
Imports System.Threading
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Thread.Sleep(5000)
Button1.Text = "Time Up"
End Sub
End Class
Re: Adding wait times;Delays pauses ect.
Okay thank you so much! The program legit Freeze's and Since It does that there is no seamless delay and I was hoping to accomplish that. Is there some sort of way I can do so.
Like here..
It is actually going to wait for 4.5 Seconds and then after that I will be displayed with the buttons being visible. I was really hoping for something that didn't actually freeze the form simply for its unprofessionality and also It doesn't act the way as intended.
Code:
Private Sub BtnDisp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDisp.Click
Thread.Sleep(1500)
BtnAbout.Visible = True
Thread.Sleep(1500)
BtnWho.Visible = True
Thread.Sleep(1500)
BtnWhy.Visible = True
First and for most I would like to thank you for helping but if you really really could help, If there is a way to add a delay without freezing Similar to the threading.