battle programmers alliance

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

 vb.net google map

View previous topic View next topic Go down 
AuthorMessage
Admin
Admin
avatar

Posts : 52
Join date : 2011-08-01

PostSubject: vb.net google map   Thu Aug 11, 2011 5: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.justforum.net
 
vb.net google map
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Sample UI Element file for google site.
» how to test search suggestions(ajax) in google?
» how to capture time/number of results in google results page
» using google chrome with selenium RC
» Selenium RC with Google Chrome on Windows server 2008

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