• (2 Pages)
  • +
  • 1
  • 2

Create a WebBrowser Step-by-Step Tutorial

#16 Guest_Lonii*


Reputation:

Posted 29 December 2010 - 07:27 AM

hi guys,

i saw this tutorial and it is a great one. i wanna make it more interesting and add some functions on it, i would want to make the homepage changeable, i know u told me how but in the code every time i load the browser the homepage that is written inside the load loads. which means that when i change the homepage it must be saved somewhere in the computer, i thought about adding a xml file which saves the homepage and every time the browser runs it loads the homepage from the xml file..can u guys help me on that or give me a better idea?

thnx in advance :)
Was This Post Helpful? 0

#17 Tom32  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 19
  • Joined: 14-August 12

Posted 15 August 2012 - 12:46 PM

View Postgbertoli3, on 29 July 2008 - 10:24 AM, said:

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!


It can also work with Visual C#. I edited this sample with C#, even!
Was This Post Helpful? 0
  • +
  • -

#18 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8934
  • View blog
  • Posts: 33,455
  • Joined: 12-June 08

Posted 15 August 2012 - 01:02 PM

... the tutorial was already in C#.
Was This Post Helpful? 0
  • +
  • -

#19 Tom32  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 19
  • Joined: 14-August 12

Posted 15 August 2012 - 01:49 PM

View Postmodi123_1, on 15 August 2012 - 01:02 PM, said:

... the tutorial was already in C#.


Oh...well that means that, looking at below:

:stupid: <- Me
:withstupid: <- You
Was This Post Helpful? 0
  • +
  • -

#20 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8934
  • View blog
  • Posts: 33,455
  • Joined: 12-June 08

Posted 15 August 2012 - 01:52 PM

What?
Was This Post Helpful? 0
  • +
  • -

#21 Tom32  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 19
  • Joined: 14-August 12

Posted 17 August 2012 - 05:45 AM

View Postmodi123_1, on 15 August 2012 - 01:52 PM, said:

What?

I'm stupid, and you're with stupid.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2