List of Exercises

Google Maps in WinForms c# using WebBrowser

	    
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 Map_Control_Google
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
      map_type.SelectedIndex = 1;
      checkBox1.Checked = true;
    }

    private void show_map_Click(object sender, EventArgs e)
    {
      string[] types = new string[] {"m","k","h","p","e" };
      string url = string.Format("http://maps.google.com/maps?t={0}&q=loc:{1}",
        types[map_type.SelectedIndex], name_Location.Text); 
      if(checkBox1.Checked)
      url = string.Format("http://maps.google.com/maps?t={0}&q=loc:{1},{2}",
        types[map_type.SelectedIndex], lat.Text, lon.Text); 
      webBrowser1.Navigate(url);
    }

    private void checkBox1_CheckedChanged(object sender, EventArgs e)
    {
      if (checkBox1.Checked)
      {
        name_Location.Enabled = false;
        lat.Enabled = true;
        lon.Enabled = true;
      }
      else
      {
        name_Location.Enabled = true;
        lat.Enabled = false;
        lon.Enabled = false;
      }
    }
  }
}
		
	 


Download the project of Visual Studio 2013 in DropBox Download


Load Google Maps in Winforms C# by using WebBrowser Control


Video Thumbnail