Using visual-studio: .Net windows application WebBrowser / Google Maps API v3 on newest questions tagged visual-studio – Stack Overflow
I’m developing an application in which the user will be able to enter a desired address and then press a button. this address will be found on the Webbrowser control in a .net windows application. I know that you can run javascripts on webbrowser by using the webbroser1.Documenttext, and the calling the script by webbrowser1.Document.invokescript…
I’m having little issues with this and i was wondering if someone could show me the right dirrection in order to do it.
my code is as follows
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim AddressMap As String
AddressMap = AddressM.Text
WebBrowser1.DocumentText = "<html><head><meta name='viewport' content='initial-scale=1.0, user-scalable=no' />" & _
"<script type='text/javascript' src='http://maps.google.com.mx/maps/api/js?sensor=true&language;=es'></script>" & _
"<script type='text/javascript'>" & _
"var geocoder; var map;" & _
"function initialize() " & _
"{geocoder = new google.maps.Geocoder(); var myOptions = { zoom: 16, mapTypeId: google.maps.MapTypeId.ROADMAP()" & _
"} var(address = " & AddressMap & ")" & _
"geocoder.geocode({ 'address': address }, function (results, status) {" & _
"if (status == google.maps.GeocoderStatus.OK) {" & _
"map.setCenter(results[0].geometry.location);" & _
"var marker = new google.maps.Marker({" & _
" map: map," & _
"position: results[0].geometry.location });" & _
"} else {" & _
"}});" & _
"map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);}" & _
"</script></head><div id='map_canvas' style='width:100%; height:100%'></div></body></html>"
WebBrowser1.Document.InvokeScript("Initialize")
End Sub
Thank you for the help, very appreciated.
Leo P.
source: http://stackoverflow.com/questions/11705729/net-windows-application-webbrowser-google-maps-api-v3
Using visual-studio: using-visual-studio
Recent Comments