Exclusively for you!! Trial version of Google Apps, Apply Coupon-CNHPGX6T6QRWGV!!

Create a browser in C# WinForms

Csharp
Csharp

Create a browser in C# WinForms

Welcome to CodeSpread!

Hi Guys, This is Sathish, one of my friend was finding difficult in creating his own web browser, so I thought lets create a simple web browser in win forms of c# and share it with you.
We are only going to use buttons, labels etc. in Win-forms and achieve our goal.
Let’s start our recipe for the day.

What is a web browser?

In Simple words, it provides a way where you just have to provide the address and can view the contents of the web. Today I will show you how to create a simple web browser .
First,let’s create a Menu bar in win-forms, so we can include any number of tabs when ever needed using Menu strip Option in toolbox. Then assign some functionality to it. It would look like this.


private void nEWToolStripMenuItem_Click(object sender, EventArgs e)

{

Form1 fm = new Form1(); fm.Show();

}
private void eXITToolStripMenuItem_Click(object sender, EventArgs e)

{

Application.Exit();

}

After creating a menu strip in the background, where I have added two menu items New and Exit,

  • New for creating a new browser window,
  • And, Exit for exiting the browser.

We will add few more items like we have to create a address bar using ComboBox,Go button,Back,Forward and web browser to the window.

Note: I am Using Combo box over here, it is required to alter the collections of combo box to the specified Url,you can also try with Textbox also.

So let’s start coding for web browser in Search Button. here I am just navigating to the url specified in the combo box.

Search Button :

private void SEARCH_Click(object sender, EventArgs e)

{

webBrowser1.Navigate(new Uri(comboBox1.SelectedItem.ToString())) ;

}

Here make sure combo box values is converted to string.

Back Button :


private void BACK_Click(object sender, EventArgs e)

{

webBrowser1.GoBack();

}

Forward Button :


private void FORWARD_Click(object sender, EventArgs e)

{

webBrowser1.GoForward();

}

It will look somewhat Like this on Completion.

Now let’s run the programming, It will look like this.


It’s Simple right; you can download the source code from

https://www.box.com/files/0/f/723677963/1/f_6786628265.
Please write your valuable queries over here or send it to admin@codespread.com,sSo that I can improve and add more value to my work.

Author: Sathish

I just loved to express myself...

Share This Post On

6 Comments

  1. nice superb explaination

    Post a Reply
  2. thanks for the tutorial
    I am having a problem.
    The feature “Create SQL server database” isn’t available , I can’t select it.
    Can you help, please ?

    Post a Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

More from CodeSpread:

  • Tips and Tricks: C# Code Expansion SnippetsTips and Tricks: C# Code Expansion Snippets“Ever felt like not writing the same code again? Yes! But what is the solution? Solution is Code Snippets.” What is a Code Snippet? Code snippets are small blocks of reusable code which contain...
  • Don’t Mess with App_OfflineDon’t Mess with App_OfflineOne of the most useful features of ASP.NET is the "App_Offline.htm" . It provides a much easy way to make the ASP.NET application offline while we do our modifications on the site. How we do it? ...
  • RegisterClientScriptBlock, RegisterClientScriptIncludeRegisterClientScriptBlock, RegisterClientScriptInclude"Current trends are more inclined towards the client model for a better UI experience where small pieces of client script are integrated into the application." These client scripts can be declarat...
  • RegisterStartupScript, RegisterOnSubmitStatementRegisterStartupScript, RegisterOnSubmitStatementWe have discussed RegisterClientScriptBlock, RegisterClientScriptInclude in our previous article here. There are two more methods to client script dynamically from server side. We will discuss thes...
  • How to make a Connection between c# and mysql?How to make a Connection between c# and mysql?This is my first article on codespread.com, titled ‘Connection between c# and mysql’.Before going into details, we should know that mysql is a open source software for data base management system. ...
  • base and this keyword in C#base and this keyword in C#I have seen programmers getting confused with keywords like 'base' and 'this'. Although self-explanatory, still requires basic knowledge of scope to dive in deep. Let's take them one by one. ba...
  • C# Code to send a MailC# Code to send a MailWhile working in a project, we always neglect the importance of the code which we have written many times and now end up in copy pasting the code from old projects. Lately, I saw a request in fo...
  • Tips and Tricks: C# Code Surround-with SnippetsTips and Tricks: C# Code Surround-with SnippetsWe have discussed Code Snippets and one of the two types, expansion snippets in our previous article: Tips and Tricks: C# Code Expansion Snippets Now, we will discuss Surround-with snippets. ...