Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

How to tell my program to wait until it has completed a task before it do a next task

I have a program that is works fine one minute but as soon as my internet connection slows it stops working.

This is because I have everything set by timers.

I have tried slowing the intervals and still it messes up from time to time.

There must be a way for the program to wait until it has completed one task and then automatically carry out the next task instead of hooking the next task up to a timer.

Here is an example of what I mean:
Code
WebBrowser1.navigate("http://www.google.com")
    [IF COMPLETED THEN MOVE ON TO NEXT TASK]
    WebBrowser1.Document.GetElementById("gbqfba").InvokeMember("click")

I'm pulling my hair out trying to work it figure it out lol

Thanks before 🤝😏
Here ya go.
http://msdn.microsoft.com/en-us/library/...leted.aspx

so you could do
Code
Private Property pageready As Boolean = False

Private Sub Load()
    WebBrowser1.navigate("http://www.google.com")
    WaitForPageLoad()
    WebBrowser1.Document.GetElementById("gbqfba").InvokeMember("click")
End Sub

#Region "Page Loading Functions"
    Private Sub WaitForPageLoad()
      AddHandler Webbrowser1.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf PageWaiter)
      While Not pageready
      Application.DoEvents()
      End While
      pageready = False
    End Sub

    Private Sub PageWaiter(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs)
      If Webbrowser1.ReadyState = WebBrowserReadyState.Complete Then
      pageready = True
      RemoveHandler Webbrowser1.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf PageWaiter)
      End If
    End Sub

#End Region
ok thanks...
how about to automatically do next event after process finished vb.net ?
like after sending email then when the sending is finished, my application closed

thx before again
You could use the same thing probably.... Not sure though.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by bytespmApr 5, 2025 08:33 AM 10 455 Apr 5, 2025 08:33 AM
Last Post: Robert Rouge
[.NET] by Haters Ganna HateJan 20, 2017 10:25 AM 3 223 Jan 20, 2017 10:25 AM
Last Post: Annabelle Lee
[C#] by AspectModdingMay 17, 2016 02:09 PM 7 231 May 17, 2016 02:09 PM
Last Post: 0xDEAD10CC