-
Oct 26th, 2012, 04:45 PM
#1
Thread Starter
Addicted Member
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.
-
Oct 26th, 2012, 04:48 PM
#2
Re: Adding wait times;Delays pauses ect.
[Sits back, opens the popcorn, waits for the fun to begin!]
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Oct 26th, 2012, 04:50 PM
#3
Re: Adding wait times;Delays pauses ect.
Thread.Sleep(5000) pauses for 5 seconds before continuing execution.
-
Oct 26th, 2012, 04:52 PM
#4
Thread Starter
Addicted Member
Re: Adding wait times;Delays pauses ect.
I hope your having fun ;P
-
Oct 26th, 2012, 04:54 PM
#5
Thread Starter
Addicted Member
Re: Adding wait times;Delays pauses ect.
Does this Freeze the Form?
-
Oct 26th, 2012, 04:56 PM
#6
Re: Adding wait times;Delays pauses ect.
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!
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Oct 26th, 2012, 07:09 PM
#7
Thread Starter
Addicted Member
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
-
Oct 26th, 2012, 07:44 PM
#8
Thread Starter
Addicted Member
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.
-
Oct 27th, 2012, 01:49 PM
#9
Thread Starter
Addicted Member
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
-
Oct 27th, 2012, 05:58 PM
#10
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
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Oct 27th, 2012, 08:40 PM
#11
Thread Starter
Addicted Member
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.
Last edited by Reapism; Oct 27th, 2012 at 08:50 PM.
Reason: I need to add some code :/
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|