Page 1 of 1

Create a WebBrowser Create a WebBrowser Rate Topic: **--- 3 Votes

#1 gbertoli3   User is offline

  • DIC at Heart + Code
  • member icon

Reputation: 41
  • View blog
  • Posts: 1,166
  • Joined: 23-June 08

Posted 02 August 2008 - 05:57 PM

In this Tutorial I will show you how to create your very own webbrowser.

You will need: 1 Toolstrip + ToolStrip Controls(explained later), 1 WebBrowser.

First thing is first, drag a toolstrip from the toolbox onto the form. Make sure that the Grip Visibility is set to Hidden.

Posted Image

Now we will add the controls. You will need:(6 ToolStripButtons, 1 ToolStripLabel, and 1 ToolStripTextBox). Now we will set the names of the controls. The first button will be called back, the second forward, the third refresh, the fourth stop, the fifth home and the last GO. For the GO button set the alignment property to right. Now that you have the names we can set each of the button's DisplayStyle to Image. Set the proper images for each button. Now we will name the label and the textbox on the toolstrip. For the Label set the text property to URL: and the name to urlLabel. Now the textbox will be named url and the text leave blank.


Next drag the WebBrowser Control onto the form.

Posted Image

Set the name property of the webbrowser to webBrowser

Now for the coding.

Double-Click on the Form and enter this code webBrowser.GoHome().
Double-Click on the Back Button and enter this code webBrowser.GoBack().
Double-Click on the Forward Button and enter this code webBrowser.GoForward().
Double-Click on the Refresh Button and enter this code webBrowser.Refresh().
Double-Click on the Stop Button and enter this code webBrowser.Stop().
Double-Click on the Home Button and enter this code webBrowser.GoHome().
Double-Click on the GO Button and enter this code webBrowser.Navigate(url.Text).
Double-Click on the webBrowser and enter this code url.Text = e.Url.ToString().

This is what your final design should look like.

Posted Image

Now run the form and have fun!

Is This A Good Question/Topic? 0
  • +

Replies To: Create a WebBrowser

#2 tbenjamin   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 02-August 08

Posted 03 April 2009 - 11:37 AM

I was just curious how to make the web brower so that everything stays in the same position when you maximize the form? Thanks.
Was This Post Helpful? 0
  • +
  • -

#3 gbertoli3   User is offline

  • DIC at Heart + Code
  • member icon

Reputation: 41
  • View blog
  • Posts: 1,166
  • Joined: 23-June 08

Posted 03 April 2009 - 03:03 PM

You set the WebBrowser's Dock style to Fill

Hope this helps
Was This Post Helpful? 0
  • +
  • -

#4 tbenjamin   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 02-August 08

Posted 03 April 2009 - 07:47 PM

View Postgbertoli3, on 3 Apr, 2009 - 02:03 PM, said:

You set the WebBrowser's Dock style to Fill

Hope this helps


Thanks a lot. :)
Was This Post Helpful? 0
  • +
  • -

#5 harley   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 28-November 08

Posted 11 July 2010 - 02:23 AM

this was very helpful
Was This Post Helpful? 0
  • +
  • -

#6 Guest_Student*


Reputation:

Posted 09 January 2011 - 04:10 AM

Help!
I made a browser using your directions.I did it for my school computer project :D
Now I want to make my browser look like chrome -.- .How to add multiple pages(tabs) to the browser? :online2long:
Was This Post Helpful? 0

Page 1 of 1