How to web browser in C#

The Web Browser control in C# allows you to host Web pages and other web browser enabled documents in your Windows Forms applications. You can add browser control in your C# projects and it displays the web pages like normal commercial web browsers .You can use the Browser control to provide integrated HTML based user assistance or Web browsing capabilities in your application.


The The Web Browser control has several properties, methods, and events related to navigation. The following C# program displays a web page in browser window and also you can retrieve the source code of the same web page with another button click.

using System;
using System.IO;
using System.Net;
using System.Diagnostics;
using System.Windows.Forms;

namespace WindowsFormsApplication1
    public partial class Form1 : Form
        public Form1()

        private void button1_Click_1(object sender, EventArgs e)
            webBrowser1.Navigate(textBox1.Text );

        private void button2_Click(object sender, EventArgs e)
            String source = ("viewsource.txt");
            StreamWriter writer = File.CreateText(source);
            Process.Start("notepad.exe", source);
} (C) 2021    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About