Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am having problems with this working with Windows 10 as the default browser fo

ID: 2246715 • Letter: I

Question

I am having problems with this working with Windows 10 as the default browser for Visual Studio is the old explorer. I am getting a message from Google saying unsupported browser. Is there a way to make it work in Firefox?

Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GIS
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void search_data_Click(object sender, EventArgs e)
        {    // String for the searches
            string city = txt_city.Text;
            string state = txt_state.Text;
            string what = txt_what.Text;

            // Try catch exceptions for searching city, state and what
            try
            {
              
                StringBuilder queryaddress = new StringBuilder();
                queryaddress.Append("http://maps.google.com/maps?q=");

                if(city!=string.Empty)
                {
                    queryaddress.Append(city+","+"+");
                }
                if (state!= string.Empty)
                {
                    queryaddress.Append(state + "," + "+");
                }
                if (what!= string.Empty)
                {
                    queryaddress.Append(what + "," + "+");
                }

                // returns the browser to show the results
                webBrowser1.Navigate(queryaddress.ToString());
            }
            // Exception error if needed
            catch (Exception ex)
            {
              
                MessageBox.Show(ex.Message.ToString(), "Error");
            }
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }
    }
} // End application

Form1.designer code

namespace GIS
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
            this.txt_state = new System.Windows.Forms.Label();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.search_data = new System.Windows.Forms.Button();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.txt_what = new System.Windows.Forms.TextBox();
            this.txt_city = new System.Windows.Forms.TextBox();
            this.webBrowser1 = new System.Windows.Forms.WebBrowser();
            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            this.SuspendLayout();
            //
            // splitContainer1
            //
            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.splitContainer1.Location = new System.Drawing.Point(0, 0);
            this.splitContainer1.Name = "splitContainer1";
            //
            // splitContainer1.Panel1
            //
            this.splitContainer1.Panel1.Controls.Add(this.txt_state);
            this.splitContainer1.Panel1.Controls.Add(this.textBox1);
            this.splitContainer1.Panel1.Controls.Add(this.search_data);
            this.splitContainer1.Panel1.Controls.Add(this.label2);
            this.splitContainer1.Panel1.Controls.Add(this.label1);
            this.splitContainer1.Panel1.Controls.Add(this.txt_what);
            this.splitContainer1.Panel1.Controls.Add(this.txt_city);
            //
            // splitContainer1.Panel2
            //
            this.splitContainer1.Panel2.Controls.Add(this.webBrowser1);
            this.splitContainer1.Size = new System.Drawing.Size(883, 553);
            this.splitContainer1.SplitterDistance = 294;
            this.splitContainer1.TabIndex = 0;
            //
            // txt_state
            //
            this.txt_state.AutoSize = true;
            this.txt_state.Location = new System.Drawing.Point(6, 92);
            this.txt_state.Name = "txt_state";
            this.txt_state.Size = new System.Drawing.Size(32, 13);
            this.txt_state.TabIndex = 7;
            this.txt_state.Text = "State";
            //
            // textBox1
            //
            this.textBox1.Location = new System.Drawing.Point(70, 86);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(100, 20);
            this.textBox1.TabIndex = 6;
            //
            // search_data
            //
            this.search_data.Location = new System.Drawing.Point(79, 152);
            this.search_data.Name = "search_data";
            this.search_data.Size = new System.Drawing.Size(75, 23);
            this.search_data.TabIndex = 5;
            this.search_data.Text = "Search";
            this.search_data.UseVisualStyleBackColor = true;
            this.search_data.Click += new System.EventHandler(this.search_data_Click);
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(6, 126);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(33, 13);
            this.label2.TabIndex = 3;
            this.label2.Text = "What";
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(6, 47);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(24, 13);
            this.label1.TabIndex = 2;
            this.label1.Text = "City";
            this.label1.Click += new System.EventHandler(this.label1_Click);
            //
            // txt_what
            //
            this.txt_what.Location = new System.Drawing.Point(69, 126);
            this.txt_what.Name = "txt_what";
            this.txt_what.Size = new System.Drawing.Size(100, 20);
            this.txt_what.TabIndex = 1;
            //
            // txt_city
            //
            this.txt_city.Location = new System.Drawing.Point(70, 47);
            this.txt_city.Name = "txt_city";
            this.txt_city.Size = new System.Drawing.Size(100, 20);
            this.txt_city.TabIndex = 0;
            //
            // webBrowser1
            //
            this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.webBrowser1.Location = new System.Drawing.Point(0, 0);
            this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
            this.webBrowser1.Name = "webBrowser1";
            this.webBrowser1.Size = new System.Drawing.Size(585, 553);
            this.webBrowser1.TabIndex = 0;
            this.webBrowser1.Url = new System.Uri("http://maps.google.com/maps?q=", System.UriKind.Absolute);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(883, 553);
            this.Controls.Add(this.splitContainer1);
            this.Name = "Form1";
            this.Text = "GIS";
            this.splitContainer1.Panel1.ResumeLayout(false);
            this.splitContainer1.Panel1.PerformLayout();
            this.splitContainer1.Panel2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
            this.splitContainer1.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.SplitContainer splitContainer1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox txt_what;
        private System.Windows.Forms.TextBox txt_city;
        private System.Windows.Forms.WebBrowser webBrowser1;
        private System.Windows.Forms.Button search_data;
        private System.Windows.Forms.Label txt_state;
        private System.Windows.Forms.TextBox textBox1;
    }
}

Explanation / Answer

The version of FIREFOX in webBrowser may be not the lastest version in your machine. You need to try reinstall your browser firefox to latest version and choose default option during install.

Clear the cache/history as well.


Thanks, let me know if it works. If not please comment, I will respond too and make it work