Baiso
Baiso

Reputation: 89

How to display a Google Maps route in a WebBrowser on a C# Windows form

My problem is the following:

I have a list of addresses and I would like to show the Google Map with the route on a WebBrowser object in my C# Windows Form.

My list is that:

        List<string> addresses = new List<string>();
        addresses.Add("Milano");
        addresses.Add("Bologna");
        addresses.Add("Venezia");
        addresses.Add("Milano");

Have you some suggestion to show the map on the WebBrowser?

Thanks

Upvotes: 0

Views: 1223

Answers (1)

Eser
Eser

Reputation: 12546

Just navigate to this url in your webbrowser control.

https://www.google.com/maps/dir/Milano/Bologna/Venezia/Milano

https://www.google.com/maps/dir/Milano/Bologna/Venezia/Milano

var url = "https://www.google.com/maps/dir/" + string.Join("/", addresses);
webBrowser1.Navigate(url);

Upvotes: 1

Related Questions