I would like to embed this to my windows form.
Private Sub InitializeComponent()
Try
Me.VirtualView = New WebBrowser
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(347, 261)
Me.Name = "frmVirtual"
Me.Text = "frmVirtual"
Me.VirtualView.ScriptErrorsSuppressed = True
Me.VirtualView.Name = "frmVirtual"
Me.VirtualView.DocumentText = "<html><body><iframe width='600' height='450' style='border: 0' src='https://www.google.com/maps/embed?pb=!1m0!3m2!1sen!2sau!4v1481252003737!6m8!1m7!1sF%3A-pwYGx-oWTIk%2FWC6LeJuIxdI%2FAAAAAAAABIg%2FphppDvMZr54JiWnLbsbUgDcTGUfGXLMRACLIB!2m2!1d-33.76525136331761!2d150.9088391438127!3f310!4f0!5f0.7820865974627469' frameborder='0' allowfullscreen></iframe></body></html>"
Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Unable to Retrieve")
End Try
End Sub
But nothing displays on this code. Please help. Thank you.
You should not be navigating the address in the
InitializeComponentmethod, use theLoad()method of the class to navigate. for this particular issue you need to set theDocumentTextproperty of theWebBrowsercontrol.On another note you are creating a new instance of the
WebBrowsercontrol, but are not adding it anywhere I could see. If you don't add it you will never see this control. IMO just drag and drop a new one where you need it.What I did here was you need to wrap the
iframeinside ahtmlandbodytags.Note: I added the
ScriptErrorsSuppressedto true because there are script error's when loading that. Also look into the new way to embed these maps, they require an API key to use in your calls here