Results 1 to 3 of 3

Thread: WebBrowser control not navigating

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2004
    Posts
    259

    WebBrowser control not navigating

    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?
    ----------------------------------------------------

    Missing the days of GWBasic 1.1
    WaxyStudios.com

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: WebBrowser control not navigating

    Any ideas what could cause a webbrowser control to simply think it lost connection or fail to self-event?
    If you hadn't gone for the 'ignore errors cos what could possibly go wrong?' approach ....

    Catch ex As Exception
    End Try

    .... we all might be a bit wiser!!!!!
    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!

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2004
    Posts
    259

    Re: WebBrowser control not navigating

    i did take that out to try and find the problem.
    but it never navigates so that wasn't the issue.

    (i took out the entire event handling sub)
    ----------------------------------------------------

    Missing the days of GWBasic 1.1
    WaxyStudios.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width