[VB][Tutorial] How to make a easy webbrowers, using Visual Basic.NET

Joined
Apr 21, 2007
Messages
432
Reaction score
1
Hi Coders,

in this tutorial I am going to teach you how to make a easy webbrowser.
Keep in mind that I am Dutch, and only 13 years old, so my English isn't that good.

Download Visual Basic here.

Start Visual Basic and make a new project via File > New Project or press CTRL + N, give the project a name, I prefer the name WebBrowser. Then click on "Ok".
casjebasje - [VB][Tutorial] How to make a easy webbrowers, using Visual Basic.NET - RaGEZONE Forums


If you did that good, you will see this:
casjebasje - [VB][Tutorial] How to make a easy webbrowers, using Visual Basic.NET - RaGEZONE Forums


Tail a Panel and a WebBrowser from the Toolbox to Form1, if you can't see the Toolbox press CTRL+ALT+X.
After tailing the Panel and the WebBrowser to Form1, tail a Textbox and a Button to Panel1.
casjebasje - [VB][Tutorial] How to make a easy webbrowers, using Visual Basic.NET - RaGEZONE Forums


Change the text of Button1 to Go! via the Text-string of the Properties of Button1.
Do the same with the Text-string of Form1, but change there the text-string to WebBrowser or whatever.

It looks a bit messy and little, isn't it?
Let's change that!
Search in the Properties of Panel1 to Dock and change it to Top.
Do the same with the Dock of WebBrowser1, but change it to Fill.
Make Form1 bigger, and tail everthing to a good browser.
Like this:
casjebasje - [VB][Tutorial] How to make a easy webbrowers, using Visual Basic.NET - RaGEZONE Forums


Start your browser up with pressing F5, type a adress in the textbox and press Go!. You see that there happens nothing, let's change that!
Close the browser.

Click two times on the Go!/Button1 and there will appear a code-screen with the following code in it:
Code:
[LEFT][COLOR=#000000]
[COLOR=royalblue]Public Class[/COLOR] Form1[COLOR=royalblue]        Private Sub[/COLOR] Button1_Click([COLOR=royalblue]ByVal [/COLOR]sender [COLOR=royalblue][COLOR=royalblue]As [/COLOR][/COLOR]System.Object, [COLOR=royalblue]ByVal [/COLOR]e [COLOR=royalblue]As [/COLOR]System.EventArgs) [COLOR=royalblue]Handles [/COLOR]Button1.Click[COLOR=royalblue]        End Sub[/COLOR][COLOR=royalblue]End Class[/COLOR][/COLOR][/LEFT]

Type between
Private Sub Button1_Click... Handles Button1.Click and End sub:
Code:
[LEFT][COLOR=#000000]
WebBrowser1.navigate (TextBox1.Text)[/COLOR][/LEFT]

After that go to the properties of TextBox1 and go to the Anchor-string.
Now you see a kind of cross, where left-part and up-part are selected.
​
Now select the right-part to.
Now do the same with Button1 but turn the left-part off and the right-part on.

Now start up your browser again with pressing F5, and type in a adress [I take google.com], you see that it works!
You have made your first browser, congratulations!
Now save your project with the Save all Project-option, and then in your project folder, go to bin >> debug/release >> to the .exe file. :]

Hope this helped you with making your first browser.

~Cas
 
Nice work, added VB tag.
 
well,

i am not experienced at all with a program language.
but i do know that you need to learn something of a tutorial.
what i now learned is how to create a visual basic project.
resize the form. drag and drop. change properties. and how to copy and paste some text from the internet.

this is a good tutorial. but explain things. because for example
Code:
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click End SubEnd Class
why are you using it? what does it means?
that kind of stuff. ofcourse i know that it is the code for the button. but what if i didn't know that? I still don't even know what the things between the () means.

so the tutorial is good and i learned a couple of things i didn't know before. but if i may say you could better add explanations of the code with it and then you have a 100% complete tutorial :winky:

​
 
well,

i am not experienced at all with a program language.
but i do know that you need to learn something of a tutorial.
what i now learned is how to create a visual basic project.
resize the form. drag and drop. change properties. and how to copy and paste some text from the internet.

this is a good tutorial. but explain things. because for example
Code:
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click End SubEnd Class
why are you using it? what does it means?
that kind of stuff. ofcourse i know that it is the code for the button. but what if i didn't know that? I still don't even know what the things between the () means.

so the tutorial is good and i learned a couple of things i didn't know before. but if i may say you could better add explanations of the code with it and then you have a 100% complete tutorial :winky:

​

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

It is default generated code in VB for Button OnClick event I suppose.
 
Try adding a few more buttons for the refresh, back, forward, and home.

Code:
[B]Refesh;[/B]
WebBrowser1.Refresh
[B]Back;[/B]
WebBrowser1.Back
[B]Forward;[/B]
WebBrowser1.Foward
[B]Home;[/B]
WebBrowser1.Home
 
Try adding a few more buttons for the refresh, back, forward, and home.

Code:
[B]Refesh;[/B]
WebBrowser1.Refresh
[B]Back;[/B]
WebBrowser1.Back
[B]Forward;[/B]
WebBrowser1.Foward
[B]Home;[/B]
WebBrowser1.Home

nice but can i make of WebBrowser1.Home 1 link that is not editable
and if it can how ?
 
Mine isn't working:
I've put this:
Code:
Public Class WebBrowser

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        WebBrowser1.navigate(TextBox1.Text)
    End Sub
End Class
I dunno if it's right because i'm getting errors. Where do i put "WebBrowser1.navigate(TextBox1.Text)"?
 
Mine isn't working:
I've put this:
Code:
Public Class WebBrowser

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        WebBrowser1.navigate(TextBox1.Text)
    End Sub
End Class
I dunno if it's right because i'm getting errors. Where do i put "WebBrowser1.navigate(TextBox1.Text)"?
that should work maybe you forgot to make the TextBox or you did rename it ..
 
Try adding a few more buttons for the refresh, back, forward, and home.

Code:
[B]Refesh;[/B]
WebBrowser1.Refresh
[B]Back;[/B]
WebBrowser1.Back
[B]Forward;[/B]
WebBrowser1.Foward
[B]Home;[/B]
WebBrowser1.Home

this wont work !

but this will:
Code:
[B]Refesh;[/B]
WebBrowser1.Refresh()
[B]Back;[/B]
WebBrowser1.GoBack()
[B]Forward;[/B]
WebBrowser1.GoFoward()
[B]Home;[/B]
WebBrowser1.GoHome()
 
Back