VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 308,429 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 3,264 people online right now. Registration is fast and FREE... Join Now!




to make the process pause

 

to make the process pause

jmyeom

8 Nov, 2008 - 10:24 AM
Post #1

New D.I.C Head
*

Joined: 8 Nov, 2008
Posts: 6

ok, im a total noob, cna someone pelase tell me how to make it wait for say... 2 seconds, then open up a link?



its my first time doing anything like this, so a nice clear explain will be good biggrin.gif

User is offlineProfile CardPM
+Quote Post


jmyeom

RE: To Make The Process Pause

8 Nov, 2008 - 10:24 AM
Post #2

New D.I.C Head
*

Joined: 8 Nov, 2008
Posts: 6

ok, im a total noob, cna someone pelase tell me how to make it wait for say... 2 seconds, then open up a link?



its my first time doing anything like this, so a nice clear explain will be good biggrin.gif
User is offlineProfile CardPM
+Quote Post

PsychoCoder

RE: To Make The Process Pause

8 Nov, 2008 - 11:05 AM
Post #3

I Code, Therefore I am
Group Icon

Joined: 26 Jul, 2007
Posts: 15,001



Thanked: 522 times
Dream Kudos: 11700
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net, jQuery

My Contributions
First, please don't create duplicate topics, I merged them into one smile.gif

Second:

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
User is offlineProfile CardPM
+Quote Post

jmyeom

RE: To Make The Process Pause

8 Nov, 2008 - 11:44 AM
Post #4

New D.I.C Head
*

Joined: 8 Nov, 2008
Posts: 6

sorry about 2 posts, dunno what happened there o.O


well, i don't have a code, im having trouble finding one....


i think im using VB.net, can you just comfirm that for me, what type im using
CODE
    Private Sub Startup_panel_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Startup_panel.Paint

    End Sub



User is offlineProfile CardPM
+Quote Post

thava

RE: To Make The Process Pause

8 Nov, 2008 - 06:27 PM
Post #5

D.I.C Addict
Group Icon

Joined: 17 Apr, 2007
Posts: 907



Thanked: 52 times
Dream Kudos: 75
My Contributions
yes it's vb.net
User is offlineProfile CardPM
+Quote Post

PsychoCoder

RE: To Make The Process Pause

8 Nov, 2008 - 07:36 PM
Post #6

I Code, Therefore I am
Group Icon

Joined: 26 Jul, 2007
Posts: 15,001



Thanked: 522 times
Dream Kudos: 11700
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net, jQuery

My Contributions
Moved to VB.NET smile.gif
User is offlineProfile CardPM
+Quote Post

magicmonkey

RE: To Make The Process Pause

9 Nov, 2008 - 05:51 AM
Post #7

D.I.C Regular
***

Joined: 12 Sep, 2008
Posts: 484



Thanked: 97 times
My Contributions
Well it depends what you want to happen during the 2 seconds, you can either put the thread to sleep, which will halt your application for 2 seconds, or you can use a timer set to 2 seconds, which will not halt your application.

Sleep
vb

Threading.Thread.Sleep(2000)


Timer
vb

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MyTimer.Delay("http://www.microsoft.com")
End Sub
End Class

Public Class MyTimer
Public Shared Sub Delay(ByVal URL As String)
Dim MyTimer As Threading.Timer
MyTimer = New Threading.Timer(New Threading.TimerCallback(AddressOf MyTimer_Elapsed), New MyTimerState(URL), 2000, Threading.Timeout.Infinite)
End Sub

Private Shared Sub MyTimer_Elapsed(ByVal state As Object)
Dim TimerState As MyTimerState = DirectCast(state, MyTimerState)
Process.Start(TimerState.URL)
End Sub

Private Class MyTimerState
Private _URL As String
Public Property URL() As String
Get
Return _URL
End Get
Set(ByVal value As String)
_URL = value
End Set
End Property

Public Sub New(ByVal URL As String)
_URL = URL
End Sub
End Class
End Class

User is offlineProfile CardPM
+Quote Post

jmyeom

RE: To Make The Process Pause

9 Nov, 2008 - 04:16 PM
Post #8

New D.I.C Head
*

Joined: 8 Nov, 2008
Posts: 6

QUOTE(magicmonkey @ 9 Nov, 2008 - 05:51 AM) *


Sleep
vb

Threading.Thread.Sleep(2000)


so if i put ...
vb

Threading.Thread.Sleep(2000)


then put a GOTO after it... it will wait 2 secands, then do a GOTO?
User is offlineProfile CardPM
+Quote Post

magicmonkey

RE: To Make The Process Pause

9 Nov, 2008 - 06:37 PM
Post #9

D.I.C Regular
***

Joined: 12 Sep, 2008
Posts: 484



Thanked: 97 times
My Contributions
Well ya, but we don't want to use a GOTO these days, maybe call a sub. My second solution is the better one, as it won't tie up the UI, however if it looks to complicated then stick with the sleep i guess.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/24/09 01:51PM

Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month