// Web Browser ve Google Link | www.yazilimcik.com
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
// Web Browser ve Google Link | www.yazilimcik.com
namespace WebBrowser_Google_Link__Yazilimcik_Com
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            wbSite.Navigate("http://www.google.com");
            txtAranacakKelime.Focus();
        }
        private void btnAra_Click(object sender, EventArgs e)
        {
            wbSite.Navigate("http://www.google.com");
            txtAranacakKelime.Enabled = true;
            txtAranacakKelime.Text = string.Empty;
            txtAranacakKelime.Focus();
        }
        private void btnGoogle_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (HtmlElement he in wbSite.Document.All)
                {
                    if (he.Name == "q")
                    {
                        he.InnerText = txtAranacakKelime.Text;
                    }
                }
                foreach (HtmlElement he in wbSite.Document.All)
                {
                    if (he.Name == "btnG")
                    {
                        he.InvokeMember("click");
                    }
                }
            }
            catch (Exception Ex)
            { MessageBox.Show(Ex.Message, "Bilgi:"); }
        }
        private void btnYazilimcik_Click(object sender, EventArgs e)
        {
            wbSite.Navigate("http://www.yazilimcik.com");
            txtAranacakKelime.Enabled = false;
            btnAra.Focus();
        }
        private void txtAranacakKelime_KeyDown(object sender, KeyEventArgs e)
        {
            // Enter’a Basinca Butonu Çalistir:
            if (e.KeyCode == Keys.Enter)
            {
                btnGoogle.PerformClick();
            }
        }
    }
}
// Web Browser ve Google Link | www.yazilimcik.com