1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need some help

Discussion in 'Visual Basic .NET' started by dycero, Jul 10, 2014.

Thread Status:
Not open for further replies.
  1. dycero

    dycero Newbie

    Joined:
    Aug 15, 2013
    Messages:
    22
    Likes Received:
    7
    I am having some trouble with this bit of code and i am not sure what is going wrong

    Code:
     Dim pageviewer As Integer = My.Settings.max_views
    
    
                        Dim pageloop As Integer = 0
                        MsgBox(pageloop & "<" & pageviewer)
                        While pageloop < pageviewer
                            MsgBox("true")
    
                            '//////////////////
                            letushide_WaitForPageLoad()
    
                            Dim totallinks As Integer = 0
                            MsgBox("HERE")
                            pageloop += 1
                        End While
    It will do the first message box with
    Code:
    0<2
    then it will do the next message box
    Code:
    true
    but the third one never shows and I am lost below is the code for the WaitForPageLoad

    Code:
      Private Sub letushide_WaitForPageLoad()
            AddHandler wb_letushide.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf letushide_PageWaiter)
            While Not pageready_letushide
                Application.DoEvents()
            End While
            pageready_letushide = False
        End Sub
    
        Private Sub letushide_PageWaiter(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs)
            If wb_letushide.ReadyState = WebBrowserReadyState.Complete Then
                pageready_letushide = True
                RemoveHandler wb_letushide.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf letushide_PageWaiter)
            End If
        End Sub

    pageready_letushide is set at the top of my program
    Code:
      Private Property pageready_letushide As Boolean = False
    
    any advise would be appreciated.
     
  2. dycero

    dycero Newbie

    Joined:
    Aug 15, 2013
    Messages:
    22
    Likes Received:
    7
    i have changed the code a little

    Code:
        Private Sub letushide_WaitForPageLoad()
            AddHandler wb_letushide.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf letushide_PageWaiter)
            While Not pageready_letushide
                Application.DoEvents()
            End While
            pageready_letushide = False
            MsgBox("loaded")
        End Sub
    and that Loaded message box it working so Now I am really lost
     
  3. dycero

    dycero Newbie

    Joined:
    Aug 15, 2013
    Messages:
    22
    Likes Received:
    7
    problem has been solved
     
Thread Status:
Not open for further replies.