Click here to Skip to main content
15,906,626 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm building a windows form app (desktop app using C#) and i've used a web browser control to display the google maps web page. Here's the code that is used.

StringBuilder queryAddress = new StringBuilder();
queryAddress.Append("http://maps.google.com/maps?q=");
webBrowser1.Navigate(queryAddress.ToString());

This shows the entire web page in the web browser control. Is there any way in which only the map can be shown? I don't want to see the sidebar and the google search bar on top.

Please help. I'm not finding any code for this on the net. All codes given are only for asp forms and not for desktop apps (i.e. they use javascript)
Posted

This does sound like an example of a beginner starting with a task that is too complex for them. There's documentation, forums and support at the google maps site. It's literally years since I used it, so I can't answer your questions directly except to say that I wrote a full integrated ASP.NET control that I used to show a map on a location I chose, to zoom in to the right level, to show pins on the map, etc. I just followed the tutorials on the google site, but I don't recall any of it to give you any more specific info.
 
Share this answer
 
You'd have to create your own web page that integrates a map, and browse to that. It can then contain js.
 
Share this answer
 
I've done that. Now how do i talk to the map? What i mean is, in the original code
queryAddress.Append("http://maps.google.com/maps?q=");
i'm using a text box called "textcity" where the user has to enter the name of the city to be shown, and a button called "btnMap" upon whose click the respective city should be shown. The following code elaborates this.
string city = string.Empty;
city = txtCity.Text.Replace(' ', '+');
queryAddress.Append(city + ',' + '+');

This works only if the main address is "http://maps.google.com/maps?q=".

But now, on your advice, i've integrated google maps into a web page "http://sraanishanth.awardspace.us".
But for this address, the above method doesn't work. When i click the buttton, the explorer throws a 404 error. Please tell me what i have to do.
Forgive me if my questions seem too silly, but i have little knowledge and only now i have started learning.
 
Share this answer
 
Yes, you are right. I shall start looking up the documentation. Thank you for your patience.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900