Loading a webpage

OliverE

Power member.
Reputation
0
Loading a webpage

webpage.png


With the increase of applications loading websites, I thought I just let everyone else know how its done.

In this quick basic tutorial ill be showing 3 ways of loading a webpage, all using the same method.




Form Load

Ok so the first method is on form load. Basically all you need to do is double click your form (creating a on form1 click sub) and paste the following universal code.

[vb]System.Diagnostics.Process.Start("http://cybertechforums.com")[/vb]

If you managed to do everything correctly, which I hope you did, you should have the following sub.

[vb]
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
System.Diagnostics.Process.Start("http://cybertechforums.com")
End Sub[/vb]

Now when you load your form, the webpage will load




On Button Click

So another popular choice is the button click. Again, just created a button, double click it (to create a on button1 click sub) and paste the same code as before.

You should end up with a sub that looks like this

[vb]Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
System.Diagnostics.Process.Start("http://cybertechforums.com")
End Sub[/vb]




On LinkLabel Click

A under rated tool is the LinkLabel, well not under rated, more under used. Basically this label works just like a text hyper link. There is link colour, an active link colour and a visited link colour, all can be set in the labels properties.

Create a link label, double click it (to create a on linklabel click sub) and again paste the same code as before.

You should end up with a sub that looks like this.

[vb]Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
System.Diagnostics.Process.Start("http://cybertechforums.com")
End Sub[/vb]




Now just try out your new feature, debug your program. As soon as it loads a webpage should appear. When you press the button the webpage should appear again. And finally when you press the link label, when you press it, the webpage should appear once more.




FAQ

Q.) What browser does the webpage load in?
A.) It will load in the default browser for the computer.




How that wasnt too hard for you :p
 
Instead of clicking on the button, when they open the program, it will automatically open this forum. Or set a hotkey.

Besides those, nice job!
 
its not all 1 block of code its 2 or 3 diffrent methods of doing the same thing
 
Yer it loads the webpage when the form loads, when the button is clicked and when you press the linklabel.

It isnt an application, just showing you ways how to use the function.
 
Back
Top