Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[VB2008] [Your 2nd program] Advanced Web Browser [Codes, Screen shots, Download]

I made a post a few days ago called "[VB2008][Your 1st program] Web browser"
It was just to teach some beginners some basic stuff to get
them going a bit in Visual Basic 2008.
Well someone said to me "There's plenty of them, Make yours more advanced"
So I did...
This is how to create a Advanced Web Browser in Visual Basic 2008.
[You may download the source at the bottom of the page, Send it out, Use the code, I don't care... Enjoy!]

I want you to do a few things to your form1 as soon as you open a new project.
Do all your basic work such as the properties, the form name, make sure you stretch your form out all the way (It's a web browser), etc.
Add 1 Combobox, 6 buttons or pictures, 1 MenuStrip, 1 ToolStatusStrip, 1 timer.

Go to the bottom of your form you will see your toolstatusstrip.
Click on it and you will see a little box pop up on the side
click that and add a progress bar.

Your form1 should look like this.
[IMG]http://i28.[censored].com/fuqo7k.jpg[/IMG]
&
[IMG]http://i25.[censored].com/2627fi0.jpg[/IMG]
--
Label your buttons or pictures what each one is.
Back, Forward, Refresh, Stop, Home, & the far right button is Go.

Take 1 tab control and make it the same size as your form 1.
It should look like this.
[IMG]http://i27.[censored].com/wb5f2e.jpg[/IMG]
--
Now go to the menu strip and your going to make 3 rows.
1. File 2. Shortcuts 3. About.

In row 1 (File) put 4 options in this order.
Add Tab
Remove Tab
Website Properties
Exit

In row 2 (Shortcuts) put 12 options in this order.
Youtube
Myspace
Hackforums
Facebook
Tagged
Hi5
Bebo
Yahoo
AOL
AIM
Google
Wikipedia

In row 3 (About) your only going to have that row "About"
Do not add options to this.
--
Now lets put some code into our buttons or pictures.

Back button:
Code
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoBack()

Forward Button:
Code
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoForward()

Refresh Button:
Code
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Refresh()

Stop Button:
Code
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Stop()

Home Button:
Code
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("hackforums.net")

Go Button:
Code
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(ComboBox1.Text)

[IMG]http://i25.[censored].com/2qte4xw.jpg[/IMG]
--
Lets put in some code in to MenuStrip now.
Go to the 1st row file and add these codes

File - Add Tab
Code
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()

File - Remove Tab
Code
If Not TabControl1.TabPages.Count = 1 Then
    TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
    TabControl1.SelectTab(TabControl1.TabPages.Count - 1)
    int = int - 1
  End If

File - Website Properties
Code
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ShowPropertiesDialog()

File - Exit
Code
Me.Close()

Lets put code into row 2 now (Shortcuts)

Shortcuts - Youtube
Code
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("www.youtube.com")

Shortcuts - Myspace
Code
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("www.myspace.com")

Shortcuts - Hackforums
Code
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("hackforums.net")

Shortcuts - Google
Code
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("www.google.com")

Shortcuts - Wikipedia
Code
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("www.wikipedia.org")

You will get the idea of adding more shortcuts (If you want)
No need for me to put the code in for all of them
Especially since you can download the project at the bottom.

Now row 3 (About)
Double click on "About" and add this code.
--
Now go to your timer1, Add in this code.
Code
Msgbox ("Put the About me of the program in here")
--
Now open your code and right under Public Class Form1
Put this whole code.
Code
Dim int As Integer = 0

    Private Sub Loading(ByVal sender As Object, ByVal e As Windows.Forms.WebBrowserProgressChangedEventArgs)
  ToolStripProgressBar1.Maximum = e.MaximumProgress
  ToolStripProgressBar1.Value = e.CurrentProgress
    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
  ComboBox1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString
    End Sub

Then double click on your form1 to get to your Form1_Load
Enter in this code.
Code
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()

It will look like this.
[IMG]http://i28.[censored].com/2uszazb.jpg[/IMG]

Now add your icon, Save your project, Build it.
And now you have an Advanced Web Browser that was coded in
Visual Basic 2008.

Here is the download for the source.
"I uploaded with MediaFire.com which scans files for a virus before uploading it"
Code
http://www.mediafire.com/?sharekey=5a00dce134c3035cd8f14848abf485dde04e75f6e8ebb871
Wow, really good work man, I just started learning some VB not that long ago, and I'm sure this can get me off to a good start.

+rep if i could :P
how well its detailed you just tought ppl how to do it right there nice work man
Come on people, Comment on this, This is a great tutorial!!!
awesome man, well explained + good pics. NICE work dude. Good for beginners like me!
Very nice :) good work
great work! im new to VB. i created my own browser but wasn't able to get certain codes. this helped me finish it.
Thank you to all 3 of you.
Great work dude helped me alot
Well, You made me this sig, And I helped you with the web browser...

Lets call it even? lol. :)
Nice Webbrowser! Keep It Up :)
this so great mate keep it up
Thanks to both of you above me ^^
I found this tutorial, and i've completely updated my current browser, and my god it looks amazing now, but my only question is, how do I get the ToolStripStatusLabel1 to update like from "Loading..." to "Done" once the web page has finished loading?

Oh yeah, how can I use cut / copy / paste / select all with this browser? as well as Open and Save... ? I had it on my previous browser, but I can't use it on the advanced one made by this amazing tutorial
Well, on the Go or enter or w/e button.
ToolStripStatusLabel1.text = "loading..."
double click the webbrowser (default should be documentcomplete)
Add
ToolStripStatusLabel1.text = "Done!"
[Image: l8foq.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by BETAhkrMay 7, 2017 05:13 AM 10 493 May 7, 2017 05:13 AM
Last Post: Ninja
[.NET] by AEDEADNov 30, 2014 02:26 PM 12 647 Nov 30, 2014 02:26 PM
Last Post: Dredd
[Shell] by 'Chief.Oct 26, 2014 08:06 AM 5 179 Oct 26, 2014 08:06 AM
Last Post: 'Snorlax