gu_a para desarrollar la aplicaci_n google maps en vb.net
TRANSCRIPT
![Page 1: Gu_a Para Desarrollar La Aplicaci_n Google Maps en VB.net](https://reader036.vdocuments.pub/reader036/viewer/2022082919/552b31f74a795905588b4611/html5/thumbnails/1.jpg)
Aplicación Google Maps
Creado Por UnMundoGeek
Diseño General Del Programa
Ventana donde se muestra el mapa:
![Page 2: Gu_a Para Desarrollar La Aplicaci_n Google Maps en VB.net](https://reader036.vdocuments.pub/reader036/viewer/2022082919/552b31f74a795905588b4611/html5/thumbnails/2.jpg)
Aplicación Google Maps
Creado Por UnMundoGeek
¡EMPEZEMOS A PROGRAMAR!
#TIP IMPRTANTE ANTES DE EMPEZAR
Arriba del public class hay que poner “imports system.text” (sin comillas)
![Page 3: Gu_a Para Desarrollar La Aplicaci_n Google Maps en VB.net](https://reader036.vdocuments.pub/reader036/viewer/2022082919/552b31f74a795905588b4611/html5/thumbnails/3.jpg)
Aplicación Google Maps
Creado Por UnMundoGeek
Programación Button1:
Try Dim street As String = String.Empty Dim city As String = String.Empty Dim state As String = String.Empty Dim zip As String = String.Empty Dim queryAddress As New StringBuilder() queryAddress.Append("http://maps.google.com/maps?q=") ' build street part of query string If txtCalle.Text <> String.Empty Then street = txtCalle.Text.Replace(" ", "+") queryAddress.Append(street + "," & "+") End If ' build city part of query string If txtCiudad.Text <> String.Empty Then city = txtCiudad.Text.Replace(" ", "+") queryAddress.Append(city + "," & "+") End If ' build state part of query string If txtEstado.Text <> String.Empty Then state = txtEstado.Text.Replace(" ", "+") queryAddress.Append(state + "," & "+") End If ' build zip code part of query string If txtCodigoPostal.Text <> String.Empty Then zip = txtCodigoPostal.Text.ToString() queryAddress.Append(zip) End If ' pass the url with the query string to web browser control MostrarMapa.WebBrowser1.Navigate(queryAddress.ToString()) MostrarMapa.Show() Catch ex As Exception MessageBox.Show(ex.Message.ToString(), "Unable to Retrieve Map") End Try
![Page 4: Gu_a Para Desarrollar La Aplicaci_n Google Maps en VB.net](https://reader036.vdocuments.pub/reader036/viewer/2022082919/552b31f74a795905588b4611/html5/thumbnails/4.jpg)
Aplicación Google Maps
Creado Por UnMundoGeek
Programación BuscarConCoordenadas: If txtLatitud.Text = String.Empty Or txtLongitud.Text = String.Empty Then MessageBox.Show("Introduce unas Coordenadas válidas", "Missing Data") End If Try Dim lat As String = String.Empty Dim lon As String = String.Empty Dim queryAddress As New StringBuilder() queryAddress.Append("http://maps.google.com/maps?q=") ' build latitude part of query string If txtLatitud.Text <> String.Empty Then lat = txtLatitud.Text queryAddress.Append(lat + "%2C") End If ' build longitude part of query string If txtLongitud.Text <> String.Empty Then lon = txtLongitud.Text queryAddress.Append(lon) End If MostrarMapa.WebBrowser1.Navigate(queryAddress.ToString()) MostrarMapa.Show() Catch ex As Exception MessageBox.Show(ex.Message.ToString(), "Error") End Try
![Page 5: Gu_a Para Desarrollar La Aplicaci_n Google Maps en VB.net](https://reader036.vdocuments.pub/reader036/viewer/2022082919/552b31f74a795905588b4611/html5/thumbnails/5.jpg)
Aplicación Google Maps
Creado Por UnMundoGeek
Resultados Finales:
El usuario ingresa los datos:
Mapa:
![Page 6: Gu_a Para Desarrollar La Aplicaci_n Google Maps en VB.net](https://reader036.vdocuments.pub/reader036/viewer/2022082919/552b31f74a795905588b4611/html5/thumbnails/6.jpg)
Aplicación Google Maps
Creado Por UnMundoGeek
¡Terminado!