0

Hi I have written a piece of a code which takes the postcode from my textbox then searches it within Bing for the user, at the moment all of it is on Form1 and works as it should, I'm looking to improve on the idea by allowing the user to press a button on Form1 then the web browser appearing in Form2, so far my attempts to figure this out have failed and was wondering if anyone had any ideas. Just as a side note this a slow progression of my programming as I'm a beginner and in the future I will be looking into implementing a Google or Bing API

I have attached a copy of my code which all works within in one Form

Public Class Form1

Dim Automate As Boolean



Private Sub BTNMap_Click_1(sender As Object, e As EventArgs) Handles BTNMap.Click



    Automate = True

    WebBrowser1.Navigate("http://www.bing.com")




End Sub


Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    If Automate = True Then Automate = False Else Exit Sub
    Dim txt As HtmlElement = WebBrowser1.Document.GetElementById("q")
    Dim btn As HtmlElement = WebBrowser1.Document.GetElementById("go")

    txt.SetAttribute("value", PostcodeTextBox.Text)
    btn.InvokeMember("click")
End Sub

Thank you for reading any advice is welcome.

Haders
  • 1
  • 1
  • possible duplicate of [Bing maps with VB](http://stackoverflow.com/questions/29904788/bing-maps-with-vb) – Ňɏssa Pøngjǣrdenlarp Apr 29 '15 at 20:26
  • I have previously posted a question but was before I figured out the error, this is for something different. – Haders Apr 29 '15 at 20:28
  • A quick instruction on resolving my problem above would great. – Haders Apr 29 '15 at 20:34
  • This seems to be a duplicate of http://stackoverflow.com/questions/29955021/using-a-web-browser-with-a-button-and-text-box-linked-across-2-forms/29955689 which I provided an answer to. – Shaun Apr 29 '15 at 22:46
  • Shaun thank you very much, apologies for the duplication on my behalf. – Haders Apr 30 '15 at 07:05

0 Answers0