Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27186

VS 2010 WebBrowser control not navigating

$
0
0
I recently updated my app a bit (added a mute option for audio.play and other things unrelated to the controls),
and for some reason just ONE of the TWO webbrowser controls has begun to experience problems.


it will navigate for the first few times and then it will simply stop navigating.
after a time out amount of time it will give the standard IE page for no internet connection.
but no other internet functions of the app are timing out, and my connection tests are perfectly fine.

What could be causing this problem?


MarketSearchList as WebBrowser implemented in form Designer
Code:

  Private Sub MarketSearchList_Navigating(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles MarketSearchList.Navigating
        If InStr(LCase(e.Url.ToString()), "go:") Then
            e.Cancel = True
            ProcessSounds(" AYE ")
            TopMostMessageBox.Show("go") 'TODO: remove debug box
            MakeGo(e.Url.ToString())
            Exit Sub
        End If
        If InStr(e.Url.ToString(), "waxystudios.com") = 0 Then
            ' I'm trying here to cancel the event so that the WebBrowser1 control doesn't go there.
            TopMostMessageBox.Show("ok") 'TODO: remove debug box
            e.Cancel = True
            ProcessSounds(" AYE ")
            'My.Computer.Audio.Play(My.Resources.aye, AudioPlayMode.Background)
            ' then start a new process with their default browser
            System.Diagnostics.Process.Start(getDefaultBrowser(), e.Url.ToString())
        End If
        e.Cancel = False
        TopMostMessageBox.Show("else") 'TODO: remove debug box
    End Sub

Code:

Private Sub btn_Logs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Logs.Click
        processsounds(" CLICK ")
        div_Market.BringToFront()
        MarketSearchList.Navigate("http://<site omitted by poster> ")
        DidMarketLogin = False
    End Sub

Code:

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        processsounds(" CLICK ")
        div_Market.BringToFront()

        MarketSearchList.Navigate("http: <site omitted by original poster>")
        DidMarketLogin = False
    End Sub

Code:

  Private Sub DisplayBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisplayBox.Click
        Dim ProductID As Integer
        Dim ProductType As String
        Dim RootMarketURL As String = "http:// <omitted by original poster>"
        Dim RootPlayerURL As String = "http:// <omitted by original poster>"

        ProductType = Microsoft.VisualBasic.Left(IDLabel.Text, 1)
        ProductID = Val(Microsoft.VisualBasic.Right(IDLabel.Text, Len(IDLabel.Text) - 2))

        Select Case UCase(ProductType)
            Case "P"
                RootPlayerURL = RootPlayerURL & "searchfor=" & DiscLabel.Text
                MarketSearchList.Navigate(RootPlayerURL)
            Case Else
                ProductType = ProductType & ProductType
                RootMarketURL = RootMarketURL & "xxxxx=" & UCase(ProductType) & "&xxxxxxx=" & DiscLabel.Text & "&xxxx=1"
                MarketSearchList.Navigate(RootMarketURL)
        End Select
        div_Market.BringToFront()
    End Sub

Code:

    Private Sub MarketSearchList_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles MarketSearchList.DocumentCompleted

        Try
            If DidMarketLogin = False Or DidSearchLogin = False Then
                If MarketSearchList.Document IsNot Nothing Then
                    If MarketSearchList.DocumentText.Contains("LOGIN EXPIRED") Then
                        DidMarketLogin = True
                        MarketSearchList.Document.GetElementById("xxxxxxxxx").InnerText = LoginForm.LoginText.Text
                        MarketSearchList.Document.GetElementById("xxxxxxxxx").InnerText = LoginForm.PasswordText.Text
                        'MarketSearchList.Document.Forms(0).InvokeMember("aaaa")
                        MarketSearchList.Document.GetElementById("aaaa").InvokeMember("click")
                    Else
                        DidMarketLogin = True
                    End If
                End If
            End If
        Catch ex As Exception
        End Try
    End Sub

that is completely the only code that refers to my WebBrowser control
and nothing else even talks to it.

Any ideas what could cause a webbrowser control to simply think it lost connection or fail to self-event?

Viewing all articles
Browse latest Browse all 27186

Trending Articles