Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
private void button6_Click(object sender, EventArgs e)
        {
            string street = txtstreet.Text;
            string city = txtcity.Text;
            string state = txtstate.Text;
            string zip = txtzip.Text;
            try
            {
                StringBuilder queryaddress = new StringBuilder();
                queryaddress.Append("https://maps.google.com.au/maps?q=");
                if(street != string.Empty)
                {
                    queryaddress.Append(street+",+");
                }
                if (city != string.Empty)
                {
                    queryaddress.Append(city+",+");
                }
                if (state != string.Empty)
                {
                    queryaddress.Append(state+",+");
                }
                if (zip != string.Empty)
                {
                    queryaddress.Append(zip+",+");
                }
                webBrowser1.Navigate(queryaddress.ToString());
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Error");
            }
        }

This is what i tried for generating the map.

I am getting script error for this code. i have four options for selection, city,street, state and zipcode. can anyone tell me why this error is coming? how can i troubleshoot?
please help
Posted
Updated 7-Dec-14 0:38am
v2

1 solution

Instead of using an embedded web browser try GMap.NET[^]...
There is also an article about it here at CP: GMap.NET - Great Maps for Windows Forms and Presentation[^]
 
Share this answer
 
Comments
BillWoodruff 7-Dec-14 7:56am    
+5 GMap.NET looks very interesting; have you used it ... do you use it ... yourself ? The last build was in Feb. 2014; but it looks like "RadioMan" is still actively developing it.

thanks, Bill
Kornfeld Eliyahu Peter 7-Dec-14 7:59am    
I didn't used it myself, but the guy at the second table integrated it into our desktop application about a year and half ago. He is a reliable guy, so I posted it...Also the link is from him (but he has no CP account)...
BillWoodruff 7-Dec-14 21:51pm    
thanks, Bill

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