How to develop a Simple Web Browser Applicationin in C#.NET
Rate this article
5.00 out of 5
Developing a custom web browser is a common task in every bodies programming career. He or she sometimes needs to develop a simple browser to more complicated custom browsers which needs can be used as part of a games application etc. In this video tutorial, I will show you how to develop a simple browser in C#.NET. This can be used as a starting point to develop sophisticated browser applications based on customer requirements. 

Watch the YouTube Video tutorial from the link below

Source Code
 FormSimpleBrowser 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SimpleBrowser
{
    public partial class FormSimpleBrowser : Form
    {
        public FormSimpleBrowser()
        {
            InitializeComponent();
        }

        private void toolStripButtonGo_Click(object sender, EventArgs e)
        {
            webBrowserCtrl.Navigate(toolStripComboBoxURL.Text);
            toolStripLabelStatus.Text = "Navigating to " + toolStripComboBoxURL.Text + " Please wait..";
        }

        private void webBrowserCtrl_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            toolStripLabelStatus.Text = "Done..";
        }
    }
}

FormSimpleBrowser
namespace SimpleBrowser
{
    partial class FormSimpleBrowser
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormSimpleBrowser));
            this.webBrowserCtrl = new System.Windows.Forms.WebBrowser();
            this.toolStripStatus = new System.Windows.Forms.ToolStrip();
            this.toolStripComboBoxURL = new System.Windows.Forms.ToolStripComboBox();
            this.toolStripButtonGo = new System.Windows.Forms.ToolStripButton();
            this.toolStripLabelStatus = new System.Windows.Forms.ToolStripLabel();
            this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
            this.toolStripStatus.SuspendLayout();
            this.SuspendLayout();
            // 
            // webBrowserCtrl
            // 
            this.webBrowserCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
            this.webBrowserCtrl.Location = new System.Drawing.Point(0, 0);
            this.webBrowserCtrl.MinimumSize = new System.Drawing.Size(20, 20);
            this.webBrowserCtrl.Name = "webBrowserCtrl";
            this.webBrowserCtrl.Size = new System.Drawing.Size(652, 341);
            this.webBrowserCtrl.TabIndex = 0;
            this.webBrowserCtrl.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowserCtrl_DocumentCompleted);
            // 
            // toolStripStatus
            // 
            this.toolStripStatus.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.toolStripLabel1,
            this.toolStripComboBoxURL,
            this.toolStripButtonGo,
            this.toolStripLabelStatus});
            this.toolStripStatus.Location = new System.Drawing.Point(0, 0);
            this.toolStripStatus.Name = "toolStripStatus";
            this.toolStripStatus.Size = new System.Drawing.Size(652, 25);
            this.toolStripStatus.TabIndex = 1;
            this.toolStripStatus.Text = "Status";
            // 
            // toolStripComboBoxURL
            // 
            this.toolStripComboBoxURL.AutoCompleteCustomSource.AddRange(new string[] {
            "http://www.tektips.in",
            "http://training.ktsinfotech.com"});
            this.toolStripComboBoxURL.Items.AddRange(new object[] {
            "http://www.tektips.in",
            "http://training.ktsinfotech.com"});
            this.toolStripComboBoxURL.Name = "toolStripComboBoxURL";
            this.toolStripComboBoxURL.Size = new System.Drawing.Size(300, 25);
            // 
            // toolStripButtonGo
            // 
            this.toolStripButtonGo.BackColor = System.Drawing.SystemColors.ActiveCaption;
            this.toolStripButtonGo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
            this.toolStripButtonGo.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
            this.toolStripButtonGo.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonGo.Image")));
            this.toolStripButtonGo.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.toolStripButtonGo.Name = "toolStripButtonGo";
            this.toolStripButtonGo.Size = new System.Drawing.Size(27, 22);
            this.toolStripButtonGo.Text = "Go";
            this.toolStripButtonGo.ToolTipText = "Go..";
            this.toolStripButtonGo.Click += new System.EventHandler(this.toolStripButtonGo_Click);
            // 
            // toolStripLabelStatus
            // 
            this.toolStripLabelStatus.ForeColor = System.Drawing.Color.ForestGreen;
            this.toolStripLabelStatus.Name = "toolStripLabelStatus";
            this.toolStripLabelStatus.Size = new System.Drawing.Size(39, 22);
            this.toolStripLabelStatus.Text = "Status";
            // 
            // toolStripLabel1
            // 
            this.toolStripLabel1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
            this.toolStripLabel1.Name = "toolStripLabel1";
            this.toolStripLabel1.Size = new System.Drawing.Size(85, 22);
            this.toolStripLabel1.Text = "Go to website";
            // 
            // FormSimpleBrowser
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(652, 341);
            this.Controls.Add(this.toolStripStatus);
            this.Controls.Add(this.webBrowserCtrl);
            this.Name = "FormSimpleBrowser";
            this.Text = "Simple Web Browser";
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            this.toolStripStatus.ResumeLayout(false);
            this.toolStripStatus.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.WebBrowser webBrowserCtrl;
        private System.Windows.Forms.ToolStrip toolStripStatus;
        private System.Windows.Forms.ToolStripComboBox toolStripComboBoxURL;
        private System.Windows.Forms.ToolStripButton toolStripButtonGo;
        private System.Windows.Forms.ToolStripLabel toolStripLabelStatus;
        private System.Windows.Forms.ToolStripLabel toolStripLabel1;
    }
}



Download Source Code

About The Author
Tom Thomas
Mr. Tom is the Co-Founder and CTO of  KTS InfoTech.  He started his career as a C/C++ programmer in the late 90's and has been very active and passionate in programming since then. He had worked both in start-ups ( Infortech software Pvt Ltd) as well as in CMM Level 5 companies (NeST and Wipro Technologies) for clients like General Electric, Agilent, Hitachi, Toshiba, Fujitsu, Alcatel, Insurance Service Corporation etc. His experience as an Engineer, Architect, Project Manager, Chief Technical Officer and as a Teacher makes him ideal for any type of jobs related to Information Technology.

His role with his present employer includes exploring new business opportunities and partnerships, Developing software product frameworks, developing and executing marketing strategies for company products etc.  

He holds Masters degree in Physics and Computer Science form CUSAT , one of the premier Science and Technology Institutions in India .

His major interests are in Optical Networking, Robotics, Device drivers, Database, Graphics, web applications, Software product Engineering, Open source Technologies and Sports physics.

He resides in Kerala ,India, with his mother, wife and his little angel.

He can be reached on Skype at this ID thomas_tom99 or at his E Mail address tom.thomas (at)ktsinfotech.com

         
Number Of articles Posted
9
Number Of Messages Posted
207
Joined Date
12/08/2011
   
Author
Messages
Posted:
Post Your Comments
Name (Max 50 Chars)
Comments

 
   
TekTipsDownload
GateExam
Academic Projects
TekTipsExperts
Android