Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I didnt show display of Google Map with longitude and latitude and also pop up the Error Script.

https://i.imgur.com/L0JjwYR.png[^]

What I have tried:

VB
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            Dim mapquery As New StringBuilder
            Dim longitude As String = TextBox2.Text
            Dim Latitude As String = TextBox1.Text
            mapquery.Append("https://maps.google.com/maps/@")
            WebBrowser1.Navigate(mapquery.ToString())
            If TextBox1.Text <> String.Empty Then
                mapquery.Append(Latitude + ",")
            End If
            If TextBox2.Text <> String.Empty Then
                mapquery.Append(longitude + ",20z")
            End If
            WebBrowser1.Navigate(mapquery.ToString)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
Posted
Updated 14-Feb-19 17:24pm
v6

Per the documentation:
Developer Guide  |  Maps URLs  |  Google Developers[^]

Display a map — launch Google Maps with no markers or directions:
https://www.google.com/maps/@?api=1&map_action=map&parameters

Important
The parameter api=1 identifies the version of Maps URLs this URL is intended for. This parameter is required in every request. The only valid value is 1. If api=1 is NOT present in the URL, all parameters are ignored

Parameters
query (required): Defines the place(s) to highlight on the map. The query parameter is required for all search requests.
In your code, the first time you attempt to navigate it is only to the "base" url with no parameters at all.
Even when you do get it built up you do not have the API version or other parameters named, just the data they contain.
 
Share this answer
 
v2
Well i thinks you got your answer thanks for sharing such information.
 
Share this answer
 
Comments
Richard Deeming 18-Feb-19 11:35am    
How is this meant to be a "solution" to the question?!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900