got an application written in vb.net, contains 2 webbrowsers. is there a way of telling webbrowser2 to navigate to a set url when the postdata is sent from webbrowser1??

Having WebBrowser1 and WebBrowser2 in Form1

Public Class Form1

    Dim sNav2 As String = "http://www.google.com" ' your Url goes here

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
        ' Initialize WebBrowser1 document:
        Dim e2 As String = ""
        e2 = "<html><head id=""hd"">" + vbCrLf
        e2 += "</head>"
        e2 += "<body id=""bd"">" + vbCrLf
        e2 += "</body></html>" + vbCrLf
        WebBrowser1.DocumentText = "<html></html>"
        WebBrowser1.Document.Write(e2)

        ' Get a string of a form:
        Dim e1 As String = "<form name=""form1"" method=""POST"" action=""" + sNav2 + """>" + vbCrLf
        e1 += "<input type=""text"" name=""sName"" value=""abcd"">" + vbCrLf
        e1 += "<input type=""submit"" name=""btnSubmit"" value=""Send"">" + vbCrLf
        e1 += "</form>" + vbCrLf

        ' Write the form into WebBrowser1:
        WebBrowser1.Document.GetElementById("bd").InnerHtml = e1
    End Sub

    Private Sub WebBrowser1_Navigating(sender As Object, e As WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
        Dim uri As System.Uri = e.Url
        If InStr(uri.AbsoluteUri, sNav2) Then
            e.Cancel = True
            WebBrowser2.Navigate(uri.AbsoluteUri)
        End If
    End Sub
End Class

xrj the code seems perfect for what i want but im stuck trying to work out how to make it work with my current code, is there a way i can send you a snippet of my code privately??

If you don't mind, I would prefer to continue, if needed, the path in this thread. BTW, you should know I'm not specially versed in webbrowser subject, just have some notions.

This article has been dead for over six months. Start a new discussion instead.