Post: VB.NET: Advanced Web Browser
05-15-2012, 11:14 PM #1
Pauly
Banned
(adsbygoogle = window.adsbygoogle || []).push({});
For this tutorial I will be teaching you how to make your very own web browser. With Tabs, Homepage, and Website Properties, as well as all the common functions (Back, Refresh, etc).
First Things First, Open up Visual Studio 2011, or 2010 this can be done on either version. Then Create a new project and call it Web Browser. Now we will start off with the design aspect of the browser first, your going to need a Tool strip, a Status strip, a tab control, and a timer.

Now your going to add a few thing to the Tool strip, 1 Drop Down Button, 6 Buttons, and 1 Combo Box. Then delete each individual tab so it looks like this. You must login or register to view this content.
Then Rename the Drop Down Button to File and add 3 Sub Menus to it called Add Tab, Close Tab, Website Properties in that order. Then rename the 6 buttons to Back, Forward, Refresh, Stop, Home, and Go In that order. So It should look like this. You must login or register to view this content.


Part 2: The Actual Code
I Will just paste the code in a spoiler for you guys to copy and paste make it easier for you. :p
Now as long as you followed the tutorial exactly as I wrote it you can just delete all the code in your project and paste this in.
    
Public Class Form1
Dim int As Integer = 0

Private Sub Loading(ByVal sender As Object, ByVal e As Windows.Forms.WebBrowserProgressChangedEventArgs)

End Sub

Private Sub Done(ByVal sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs)
TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle
ToolStripComboBox1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Browser As New WebBrowser
TabControl1.TabPages.Add("New Page")
Browser.Name = "Web Browser"
Browser.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Browser)
AddHandler Browser.ProgressChanged, AddressOf Loading
AddHandler Browser.DocumentCompleted, AddressOf Done
int = int + 1
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoHome()
End Sub

Private Sub AddTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddTabToolStripMenuItem.Click
Dim Browser As New WebBrowser
TabControl1.TabPages.Add("New Page")
TabControl1.SelectTab(int)
Browser.Name = "Web Browser"
Browser.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Browser)
AddHandler Browser.ProgressChanged, AddressOf Loading
AddHandler Browser.DocumentCompleted, AddressOf Done
int = int + 1
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoHome()
End Sub

Private Sub RemoveTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseTabToolStripMenuItem.Click
If Not TabControl1.TabPages.Count = 1 Then
TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
TabControl1.SelectTab(TabControl1.TabPages.Count - 1)
int = int - 1
End If
End Sub

Private Sub WebsitePropertiesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WebsitePropertiesToolStripMenuItem.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ShowPropertiesDialog()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoBack()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoForward()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Refresh()
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton4.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Stop()
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton5.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoHome()
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(ToolStripComboBox1.Text)
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

End Sub
End Class

And here is the end result! =D
You must login or register to view this content.
(adsbygoogle = window.adsbygoogle || []).push({});

The following 6 users say thank you to Pauly for this useful post:

Branhdon, IzBoogz, Lovol, Ninja, Pichu
05-16-2012, 06:48 PM #11
Epic?
Awe-Inspiring
Originally posted by .Pauly. View Post
I love how you guys are actually criticizing this, it's not supposed to be like chrome it's just a simple browser in VB. :dumb:


Well perhaps it was misleading when you titled it "Advanced Web Browser".

Aside from that, I'm not a particular fan of your tutorial. Your text-based directions were unclear and poorly formatted. You failed to follow elementary stylistic standards. Your pictures are rather lacking. Just handing out the code without any explanation doesn't really teach anything. Perhaps most importantly, unlike your title might suggest, this tutorial is not advanced - I'd hardly even call it beginner; to me, you having written such a tutorial indicates that you do not personally know how to program.
05-16-2012, 09:32 PM #12
Pauly
Banned
Originally posted by Epic
Well perhaps it was misleading when you titled it "Advanced Web Browser".

Aside from that, I'm not a particular fan of your tutorial. Your text-based directions were unclear and poorly formatted. You failed to follow elementary stylistic standards. Your pictures are rather lacking. Just handing out the code without any explanation doesn't really teach anything. Perhaps most importantly, unlike your title might suggest, this tutorial is not advanced - I'd hardly even call it beginner; to me, you having written such a tutorial indicates that you do not personally know how to program.

I'm not a fucking grammar Nazi like you, not every single word and or sentence is going to be absolutely perfect and if it isn't perfect it doesn't mean that I don't know how to program, because I do. And for the title saying "Advanced" I meant that in the way that most tutorials for web browsers just have a Go and a Back button. Also it seems that everyone else was able to understand it just fine, but thanks for the feedback. :p
05-17-2012, 12:33 AM #13
Epic?
Awe-Inspiring
Originally posted by .Pauly. View Post
I'm not a $#@!ing grammar Nazi like you, not every single word and or sentence is going to be absolutely perfect and if it isn't perfect it doesn't mean that I don't know how to program, because I do. And for the title saying "Advanced" I meant that in the way that most tutorials for web browsers just have a Go and a Back button. Also it seems that everyone else was able to understand it just fine, but thanks for the feedback. :p


I don't believe I ever linked grammar to ability to program.

Also, I am not a "Grammar Nazi". I do not have perfect grammar myself, and I do not demand "every single word and[/]or sentence" to be absolutely perfect. I just wish that people would use a tiny fraction of intelligence and time to type with respectable grammar; at least so they do not appear totally incompetent.
05-17-2012, 03:15 AM #14
Pauly
Banned
Originally posted by Epic
I don't believe I ever linked grammar to ability to program.

Also, I am not a "Grammar Nazi". I do not have perfect grammar myself, and I do not demand "every single word and[/]or sentence" to be absolutely perfect. I just wish that people would use a tiny fraction of intelligence and time to type with respectable grammar; at least so they do not appear totally incompetent.

My grammar in the post was fine, you just need to stop trolling.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo