VISUAL_BASICSHow to make an advanced webbrowser

Posts 1–15 of 27 · Page 1 of 2
How to make an advanced webbrowser
Ok. In this Thread, I will show you how to create an advanced web browser that includes
*Tab
*File>Add Tab>Remove Tab>Website Properties>Exit
*Back
*Forward
*Refresh
*Stop
*Home
*Go
*A Progress Bar
*etc...
&The Good Part is, is its fast. Faster than IE!!! Well. Atleast mine &

*FIRST. Sorry. Forgot to put this in.*
Ok. Double click Form1. THE FIRST. Code you need to put in there. Is this:
Code:
Dim int As Integer = 0
So. Like the code should look like this, but DONT put this in. Put the code above in:

Code:
Public Class Form1
    Dim int As Integer = 0
Add A MenuStrip Make the First Tab "File"
Then Add one that says
"Add Tab"
"Remove Tab"
"Website Properties"
"Exit"

Now, Add 6 Buttons.
Make there text the following:
Button 1:Back
Button 2:Forward
Button 3:Refresh
Button 4:Stop
Button 5:Home
Button 6:Go
********************************************
Click File. And then Double click Add Tab.
Enter this code:
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()
Ok. Now your done with that. Then click Remove Tab. And enter the following code:
Code:
If Not TabControl1.TabPages.Count = 1 Then
            TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
            TabControl1.SelectTab(TabControl1.TabPages.Count - 1)
            int = int - 1
        End If
Ok. NOW. Ur done with that... Lol. Still more.
Click Website Properties, Add the following code:

Code:
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ShowPropertiesDialog()
Ok. And this next code is SOO SIMPLE!! Click Exit and enter the following:
Code:
        End
But make sure the word: End is aligned with the other codes.

Ok. Now add a Tab Control.
Make it as big as you want to be able to see the website screen. So like. If your on a website. Make it as big as you want.

Oh ya. Make a StatusStrip.
Put it on the bottom. Make sure you DONT change the name. And add a ProgressBar And put it after the word "ToolStripStatus1"

And when you add the Tab Control, go to Properties, and Under TabPages, Delete ALL. Of. Them.

Now time for the buttons to make the browser go (Back, Forward, Refresh, Stop, Home, Go)

Ok. Double click Back and add the following code:

Code:
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoBack()
Ok. Double click Forward And add the following code:

Code:
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoForward()
Ok. Double click Refresh And add the following code:

Code:
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Refresh()
Ok. Double click Stop and enter the following code:

Code:
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Stop()
Ok. Double click Home and enter the following code:

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

Ok. Double click Go and enter the following code:

Code:
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(ComboBox1.Text)
Ok. LOL. Wow. Lots.

PHEW!! NOW.. Add a Timer.

Add this code:

Code:
ToolStripStatusLabel1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).StatusText
Now add a ComboBox.
Put the combo box in between "Home" and "Go", well thats where I put it. Cuz thats where it would normally be.

Now. The SOURCE code. Double click Form1 And enter the following 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()
Ok. After all this trouble. The final code should look like this:

Code:
Public Class Form1
    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

    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 RemoveTabToolStripMenuItem.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 Button1.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 Button2.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 Button3.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 Button4.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 Button5.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 Button6.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(ComboBox1.Text)
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ToolStripStatusLabel1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).StatusText
    End Sub

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        End
    End Sub
End Class
__________________________________________________ _____
There. Ok. Well. Did I forget something? Problems? Suggestions? Improvements? PM me. Did this work 100% for you? Please thank me
Crossfire player? Add me. [E]lite-*Boi. Now, your free to edit background, add features. You wanna put your name and what website it came from (Of course, MPGH.net) If ppl are going to leech from you. Please, post results! Cant wait!!!
Omg Why isnt anyone posting?
Nice, Very Easy to Follow and Good job
My Webbrowser is called BitchBrowser xD
Awesome. Can you umm. Post a screenie? I wanna see
nice tut man
not that imma use it lawl
but its good
Quote Originally Posted by InHuman View Post
nice tut man
not that imma use it lawl
but its good
Banned for 3,000 posts
nice tut im using it ,its better than IE but i use firefox

edit;i get 24 times; tabcontrol1 is not declared when i try to debug... help me!?¿? plz XD
its realy nice but one flaw i should point out
is that ur Add tab
and source code
are both the same LOL
so u get a few errors xD
right at the beginning. u said 'double click FORM1' whats form1? u didnt tell me to crete a new project, or a file or anything. just 'double click form1' someone tell me what form1 is plz. im using visual c++ 2008 express edition. ty
how do you make it so if you press the Maximize button, the webpage maximizes too?
can someone please tell me what form1 is?
Easy Too Follow ... Can people Post screenies of theirs?
W00t, when you showed all the text you had done and loading too?
WHERE CAN I GET THEM ?
Posts 1–15 of 27 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

Need help?