Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
public partial class GetLocation : Form
    {
        delegate void DecodePositionEvent();

        GeoPostion geoPosition;
        public GetLocation()
        {
            InitializeComponent();

            geoPosition = new GeoPostion();
        }

        private void DecodePosition()
        {
            try
            {
                if (geoPosition != null)
                {
                    mapBrowser.Navigate(string.Format("https://maps.google.com/maps?q=" +
                    geoPosition.GeoLatitude + "," + geoPosition.GeoLongtitude));
                }
            }
            catch(Exception error)
            {
                MessageBox.Show(error.Message, "Error Loading Map.");
            }
        }

        private void GetLocation_Load(object sender, EventArgs e)
        {
            try
            {
                GeoPostion.GetGeoPositions();

                computersCmBox.BindingContext = new BindingContext();
                computersCmBox.DataSource = GeoPostion.AssetGeoPos;
                computersCmBox.DisplayMember = "ComputerName";
                computersCmBox.ValueMember = "Staff_ID";
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "Error Loading Geo-Position");
            }
        }

        private void computersCmBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if(computersCmBox.SelectedIndex > 0)
            {
                geoPosition = GeoPostion.AssetGeoPos.Find(geo => geo.Staff_ID.Equals(computersCmBox.SelectedValue));

                if(geoPosition != null)
                {
                    if (Utilities.IsStringEmpty(geoPosition.ComputerName).Equals(false) & computersCmBox.SelectedValue.Equals(-1).Equals(false))
                    {
                        Utilities.AssignData(new string[] { geoPosition.GeoLatitude, geoPosition.GeoLongtitude, geoPosition.DateStamp + ": " + geoPosition.TimeStamp },
                            latitudeTxt, longtitudeTxt, timeStampTxt);

                        new DecodePositionEvent(DecodePosition).Invoke();
                    }
                    else
                    {
                        mapBrowser.Navigate("about:blank");
                        Utilities.ClearControl(latitudeTxt, longtitudeTxt, timeStampTxt);
                    }
                }
            }
        }

        private void closeBtn_Click(object sender, EventArgs e)
        {
            this.Hide();
            this.Dispose();
        }
    }
}


The bolded line is the source of the problem because the error I get is below:

You seem to be using an unsupported browser.
Old browsers can put your security at risk, are slow and don't work with newer Google Maps features. To access Google Maps, you'll need to update to a modern browser.
Posted

1 solution

Hi,

the problem is that webbrowser control uses Internet Explorer 7. You have to tell the computer to use ie11.

Follow this tutorial: http://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version

Here's more information http://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version


you have to add a key in the windows register and then restart your application. That worked for me.

Hope this helps.

LG
 
Share this answer
 
v3
Comments
Admire Mhlaba 7-Jun-15 15:54pm    
Good day Lusvardi Gianmarco, thank you for your insightful pointers, the link really helped and my problem has been solved.....
LLLLGGGG 7-Jun-15 16:02pm    
Could you accept the solution with the button in order to tell others that the problem has been solved?
Thanks a lot. I'm happy to help.

LG
Michael Haephrati 13-Jun-17 7:09am    
I think the ideal solution must allow these definitions within the source code with no need to play around the user's Registry keys

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