Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
October 2017
SunMonTueWedThuFriSat
1234567
891011121314
15161718192021
22232425262728
293031    

Calendar Calendar

RSS feeds


Yahoo! 
MSN 
AOL 
Netvibes 
Bloglines 


Social bookmarking

Social bookmarking Digg  Social bookmarking Delicious  Social bookmarking Reddit  Social bookmarking Stumbleupon  Social bookmarking Slashdot  Social bookmarking Yahoo  Social bookmarking Google  Social bookmarking Blinklist  Social bookmarking Blogmarks  Social bookmarking Technorati  

Bookmark and share the address of battle programmers alliance on your social bookmarking website

vb.net google map

View previous topic View next topic Go down

vb.net google map

Post  Admin on Thu Aug 11, 2011 1:13 am

add text boxes to hold street, city, state and zip
Add search button
add : in the code first line
Imports System.Text

in the button click event (double click it and paste) :

Code:
Try
Dim streetaddr As String = ""
Dim cityaddr As String = ""
Dim stateaddr As String = ""
Dim zipaddr As String = ""
Dim AddrToSearch As New StringBuilder()
AddrToSearch.Append("http://maps.google.com/maps?q=")

' if there is street entry
If txtStreet.Text <> "" Then
streetaddr = txtStreet.Text.Replace(" ", "+")
AddrToSearch.Append(street + "," & "+")
End If

' if there is city entry
If txtCity.Text <> "" Then
cityaddr  = txtCity.Text.Replace(" ", "+")
AddrToSearch.Append(city + "," & "+")
End If

' if there is state
If txtState.Text <> "" Then
stateaddr = txtState.Text.Replace(" ", "+")
AddrToSearch.Append(state + "," & "+")
End If

' if there is zip code
If txtZipCode.Text <> "" Then
zipaddr = txtZipCode.Text.ToString()
AddrToSearch.Append(zip)
End If

' pass the AddrToSearch value to web browser control
wbrowser.Navigate(AddrToSearch.ToString())

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Problem encountered while retrieving google map")

End Try

search the map by latitude and longitude add theire textboxes and button in it's event paste :

Code:
Try
Dim latitude As String = ""
Dim longitude As String = ""
Dim AddrToSearch As New StringBuilder()
AddrToSearch.Append("http://maps.google.com/maps?q=")

' if there is latitude
If txtLatitude.Text <> "" Then
latitude = txtLatitude.Text
AddrToSearch.Append(latitude & "%2C")
End If

' if there is longitude
If txtLongitude .Text <> "" Then
longitude = txtLongitude .Text
AddrToSearch.Append(longitude)
End If

' pass the AddrToSearch value to web browser control
wbrowser.Navigate(AddrToSearch.ToString())

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Problem encountered while retrieving google map")

End Try
avatar
Admin
Admin

Posts : 58
Join date : 2011-08-01

View user profile https://yotamarker.justforum.net

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum