Make Money Online Queries? Struggling To Get Traffic To Your Blog? Sign Up On (HBB) Forum Now!

HOW TO: Develop Simple Web Browser Using C# [With URL Navigating]

CONNECT WITH HBB ON SOCIAL MEDIA

This tutorial will explain, how to develop a Web browser which Navigate URL in the Text Box using C#(Sharp). Text Box mentioned here is the address bar of your Web Browser. PreviousIy I have written some article about how to develop a Simple Web Browser and how to add some features to it using C# (Sharp), you can refer that for more details. You are recommended to use Microsoft Visual Studio.

We have screen shots here and have a look at it, same URL but two different blog contents, doesn’t it look annoying? When you execute the Bowser, it automatically loads Hellboundbloggers.com content and after I click on Home Button, browser loads tekkieblog content. The issue here is, it will not display the URL of tekkieblog.com in the Adress bar. When I again click on back button it loads Hellboundbloggers.com content with HBB URL in the Adress bar. There is no change in the URL because the Adress bar does not Navigate the URL and it only displays the content. So, to display appropriate URL in the Address bar while Navigating, we have to fire two events namely Text Changed Event of the Text Box and the Navigated Event of the Web Browser Control.

TekkieBlog - Tekkie Browser

Text Changed Event of the Text Box

Install Microsoft Visual Studio if you haven’t. After that, right click the Text Box in the design mode and select Properties and then select events in the Properties window and move to Text Changed event and double click it.

READ
HOW TO: Listen & Download MP3 Songs For Free Legally

The TextChanged event is raised when the content of the text box changes between posts to the server. Add the following code snippet.


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

Develop Web Browser I

Navigated Event of the Web Browser Control

Right click the Web Browser control in the design mode and select Properties and then select events in the Properties window and move to Navigated event and double click it.

The Web Browser control navigates to a new document whenever one of the following properties is set or methods is called Url, DocumentText, DocumentStream, Navigate, GoBack, GoForward, GoHome, GoSearch. Add the following code snippet.


private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
textBox1.Text = webBrowser1.Url.ToString();
}

HBB - Tekkie Browser

In my case, Web Browser control name is webBrowser1, Text Box name is textBox1, change the Text property of the Form to any name you like. Press F5 to start the Debugging or Debug –> Start Debugging.

This article is written by Narendran. He is the founder and editor of Tekkieblog. He always strives himself to find simple solution for complex problems. If you wish to write for us, kindly check this.



By

Narendran.M is the owner of Tekkie Blog. He always strives himself to find simple solution for complex problems. He proudly says "ALWAYS THINK BIGGER, SO THAT YOU'LL REACH HIGHER".

Want to discuss your queries and interact with experts? You can connect with HellBound Bloggers (HBB) Facebook group for free!

Join HellBound Bloggers (HBB) and get Instant Updates. We'll also notify you with Great Deals, Discounts and other Interesting Tips. We won't SPAM or SHARE your Email Address with anyone.

Thank you for reading! We welcome and appreciate your comments, but at the same time, make sure you are adding something valuable to this article. If you have any serious queries, suggestions or anything related to this article, feel free to share them, we really appreciate that.

But, if your blog comments are a random "Thank you", "Useful Post", or anything that doesn't actually upscale the article, then we'll be removing them and it won't be appeared below. Thanks for understanding and thanks for connecting with us. If you want to give us any feedback or report any errors, you can kindly contact us and we'll revert back soon.

  • Comments
  • Facebook Comments
More in Featured, Guides
10 Kickass Firefox Plugins For Hackers*

Close