run a webpage from inside my program ?

wa0h

New member
Joined
Sep 22, 2012
Messages
4
Location
springfield, mo
Programming Experience
10+
i wrote a (visual basic.net-2008) desktop app that allows ham radio operators to enter a call, such as WA0H, and the program gives the ham's location (springfield, mo.).

you can download the program free from my website .. www.wa0h.com

i want the program to display the ham's location on a google map using google's api-v3.

i have created an (html/javascript) webpage, where you enter the location in a form box, click a (find) button, and the app displays the map ok, including a marker pin on the map.

??? how do i run the (webpage) from inside my (vb.net) program ???

my vb.net program needs to:
1 .. pass the address to the webpage
2 .. click the webpage (find) button

thanks for your time.
 
You can either add a WebBrowser control to your Windows Form and load the page there or else start the users own web browser application using Process.Start.

thanks for the suggestion.

for several years, my program used the vb.net WebBrowser control to correctly display the entered location on a google map.

Dim Location as String = "123 Elm,+Boston,+MA"
Dim GoogleMapString as String
GoogleMapString = "http://maps.google.com/maps?q=" & Location & "&hl=en&t=m&z=11"
WebBrowser1.Navigate(GoogleMapString)

a few month ago google changed things .. if you use the old method, you get a scripting error message .. a search on the internet revealed many developers are getting the scripting error.

google's new method requires you to use their (api) .. using google's websites, i found references to web-pages that work.

here is an (html/javascript) web-page that uses google (api) to display a google map .. on the web-page, you enter an address and then click the (Display Map) button.

non-pertinent lines have been removed or altered.

Dim HtmlForMap as String
HtmlForMap =
<!DOCTYPE html>
<head>
<!-- ---------------------------------------------->
<!-- javascript to access the google website -->
<!-- ---------------------------------------------->
<script type='text/javascript' src=
'https://maps.googleapis.com/maps/api/js?
key=MyOwnGoogleKey&sensor=false'>
</script>
<!-- --------------------------------------------->
<!-- javascript function that is called when -->
<!-- you enter a location in the web-page -->
<!-- (txtAddress) field and click the -->
<!-- web-page (Display Map) button. -->
<!-- --------------------------------------------->
<script type='text/javascript'>
function getLatLng ( ) { *** this is the entry point to the webpage ***
var MapLoc = document.getElementById ('txtAddress').value; } *** this is where the address goes ***
</script>
</head>
<!-- ------------------------------------------>
<!-- define the web-page, it contains: -->
<!-- (txtAddress) to enter a location. -->
<!-- (btnShowMap) to display the map. -->
<!-- ------------------------------------------>
<body>
<input id="txtAddress" type="text" />
<input id="btnDisplayMap" value="Display Map" onclick="getLatLng( ); />
</body>
</html>

'-- Vb.net code to display the web-page --
RichTextBox1.Text = HtmlForMap
WebBrowser1.DocumentText = RichTextBox1.Text

this routine does not work because i don't know how to pass an address to the (html/javascript) code .. and how to start the (html/javascript) code at the function getLatLng ( ).

google's developer webpage says to address programming questions to forums.

thanks .. wa0h
 

Latest posts

Back
Top