New Webbrowser Advanced - Make it your own - TUT

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
13 posts Page 1 of 2
Contributors
User avatar
Zelsoft
Top Poster
Top Poster
Posts: 99
Joined: Mon Aug 10, 2009 4:41 am

the basics in any web browser is adding a tab control a few buttons for navigation and a text box for the url
so to start of add these things in your web browser add:

1 timer
1 tab control - Make sure you delete all the tabs
9 buttons
and last add a stat strip with 1 label and one progress bar named ToolStripProgressBar1 for the progress bar and
any name for the label

next add 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

Form1_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()

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

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

Website Properties:
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ShowPropertiesDialog

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

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

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

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

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

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

Timer1:
ToolStripStatusLabel1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).StatusText

and you have a semi advanced web browser
for other cool stuff like favicon, history and bookmarks

follow this

for a favicon add a picture box next to the URL text box

in the

after that add this code

note add this code under Private Sub Done don't erase the code already in there put this code under that code

Dim url As Uri = New Uri(textbox1.Text) If url.HostNameType = UriHostNameType.Dns Then Dim iconURL = "http://" & url.Host & "/favicon.ico" Dim request As System.Net.WebRequest = System.Net.HttpWebRequest.Create(iconURL) Dim response As System.Net.HttpWebResponse = request.GetResponse() Dim stream As System.IO.Stream = response.GetResponseStream() Dim favicon = Image.FromStream(stream) Me.PictureBox1.Image = favicon End If

for adding the history add-on follow this:

first go to my project in visual basic
then go to settings and add a item by clicking on settings item in there already and change the name to history
then go to the type and change it to system.collections.specialized.string collection
after that my a new form for the history and add a list box and in the form load type this in

For Each item As String In My.Settings.History
ListBox1.Items.Add(item)
Next

then go to your main form and in the private sub done add this code

My.Settings.History.Add(CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).url.tostring())
My.Settings.Save()

for bookmarks download this
http://www.mediafire.com/?ywjnzjinjym

and there you go thats how to make an advanced web browser if you want to know more stuff about advanced webbrowser or any questions message me at Zelsoft@hotmail.com
- WuSaMi Bringing the Pro in Programmers Once again
User avatar
zachman61
VIP - Donator
VIP - Donator
Posts: 1892
Joined: Wed Dec 16, 2009 9:56 pm

sorry to tell you but this has been posted alot before
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that :)
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

zachman61 wrote:
sorry to tell you but this has been posted alot before
Yeah i agree with zach this has been posted/made before. and i don't think that there is anything new in vb.net made webbrowsers. everything has been done on this subject.
Don't take this the wrong way i like "Home made browsers" but try to make it a little more advanced or make a cool interface to it, it doesn't matter if its a simple webbrowser but with a "cool interface" and a few atractive features(Theme change, an HTML PAGE/URL Grabber) you will see that people will see it with another look. This is just an advice not for you but for all of us "Programmers".
(sorry for my bad English I'm Romanian)
You can find me on Facebook or on Skype mihai_92b
User avatar
Agust1337
Coding God
Coding God
Posts: 2456
Joined: Fri Feb 19, 2010 8:18 pm

And when your making a tutorial, always use "['code'] Codes here ['/code']" remove the ' ' and " "
Top-notch casual Dating
User avatar
Zelsoft
Top Poster
Top Poster
Posts: 99
Joined: Mon Aug 10, 2009 4:41 am

my web browser is way more advanced i know every thing about making one i have been making web browsers for 2 years now and ive made over 15 different ones so if yu think that i dont know alot about them then ask me any question and i willl answer it i know that not alot of stuff about making them has been posted because i couldn't put it all in here
- WuSaMi Bringing the Pro in Programmers Once again
User avatar
Agust1337
Coding God
Coding God
Posts: 2456
Joined: Fri Feb 19, 2010 8:18 pm

Zelsoft wrote:
my web browser is way more advanced i know every thing about making one i have been making web browsers for 2 years now and ive made over 15 different ones so if yu think that i dont know alot about them then ask me any question and i willl answer it i know that not alot of stuff about making them has been posted because i couldn't put it all in here
How is it more advanced? Though its tabbed that doesn't mean its advanced.
Top-notch casual Dating
User avatar
Axel
Coding God
Coding God
Posts: 1928
Joined: Sun Jun 27, 2010 9:15 pm

Agust1337 wrote:
Zelsoft wrote:
my web browser is way more advanced i know every thing about making one i have been making web browsers for 2 years now and ive made over 15 different ones so if yu think that i dont know alot about them then ask me any question and i willl answer it i know that not alot of stuff about making them has been posted because i couldn't put it all in here
How is it more advanced? Though its tabbed that doesn't mean its advanced.
lol + the code for the favicon is exactly the same as someone else(im not posting link...)
http://vagex.com/?ref=25000
User avatar
Axel
Coding God
Coding God
Posts: 1928
Joined: Sun Jun 27, 2010 9:15 pm

actually , i guess you understand 1/3th of the code "you wrote" if not , tell me what Ctype means :D
http://vagex.com/?ref=25000
User avatar
NecroPhis
VIP - Donator
VIP - Donator
Posts: 345
Joined: Sun Aug 08, 2010 1:14 pm

hm not very advaned and i think it posted b4
Image
User avatar
Axel
Coding God
Coding God
Posts: 1928
Joined: Sun Jun 27, 2010 9:15 pm

YourSocksRoxx wrote:
actually , i guess you understand 1/3th of the code "you wrote" if not , tell me what Ctype means :D
no answer yet...
http://vagex.com/?ref=25000
13 posts Page 1 of 2
Return to “Tutorials”