articles

Home / DeveloperSection / Articles / Creating Web Browser Application in Windows Forms

Creating Web Browser Application in Windows Forms

Anurag Chaurasia9764 14-Feb-2011

      · First, you have to add a namespace in your existing namespaces that will be System.Net which will provide the functionality to represent the networking related facilities in our programming. 

      · Then On your GUI window add two panels into your windows form. 

      · In first panel you have to add one label and text box and also five buttons and put the text properties of these buttons like Go, Forward, Backward, Home & Refresh.

      · In the second panel you have to add a web browser control from the toolbox.

      · Now double click on every button and put that code 

      Code:

      using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.Data;
      using System.Drawing;
      using System.Text;
      using System.Windows.Forms;
      using System.Net;
       
      namespace Web_Browser
      {
          publicpartialclassForm1 : Form
          {
              public Form1()
              {
                  InitializeComponent();
              }
       
              privatevoid button1_Click(object sender, EventArgs e)
              {
                  webBrowser1.Navigate(textBox1.Text);
              }
       
              privatevoid button2_Click(object sender, EventArgs e)
              {
                  webBrowser1.GoForward();
              }
       
              privatevoid button3_Click(object sender, EventArgs e)
              {
                  webBrowser1.GoBack();
              }
       
              private void button4_Click(object sender, EventArgs e)
              {
                  webBrowser1.Refresh();
              }
       
              private void button5_Click(object sender, EventArgs e)
              {
                  webBrowser1.GoHome();
              }
          }
      }

      Now run the programme and you will see the output like that…..

      Creating Web Browser Application in Windows Forms

       

       


      c# c# 
      Updated 21-Sep-2019

      Leave Comment

      Comments

      Liked By