Ad

Saturday, February 1, 2014

Implement WebBrowser in Windows Applications Using C#.Net

Overview:
In this article i would like to publish an article related to the WebBrowser control.



WebBrowser is one of the control which resambles as a Webbrowser in our day to day i.e like InternetExplorer,GoogleChrome,MozillaFirefox For more about WebBrowsers you must watch this link

Usage:
It is used to navigate from one site to other and make all the operations which can be done with our webbrowsers.

Implementation:
Step 1:Design the page as follows as
















Step 2:Write the Following Code in .cs Page
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;

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

        private void button1_Click(object sender, EventArgs e)
        {
            webBrowser1.Navigate(textBox1.Text);
        }

        private void btnForward_Click(object sender, EventArgs e)
        {
            webBrowser1.GoForward();
        }

        private void btnBack_Click(object sender, EventArgs e)
        {
            webBrowser1.GoBack();
        }

        private void btnPrevious_Click(object sender, EventArgs e)
        {
            webBrowser1.SendToBack();
        }

        private void btnHome_Click(object sender, EventArgs e)
        {
            webBrowser1.GoHome();
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            webBrowser1.Refresh();
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            webBrowser1.GoSearch();
        }
    }
}


Output:

No comments: