battle programming a forum for elite programmers with extreme will power to sharpen theire skills
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in
Share
 

 vb.net google map

Go down 
AuthorMessage
Admin
Admin
Admin

Posts : 127
Join date : 2011-08-01

vb.net google map Empty
PostSubject: vb.net google map   vb.net google map EmptyThu 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
Back to top Go down
View user profile http://yotamarker.forumotion.com
 
vb.net google map
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
battle programmers alliance :: battle programming alliance :: battle programming-
Jump to: