Features:
Forward and Back.
Home page.
Search engines work (pressing enter instead of search won't fuck it up).
The url bar now displays the URL of the current page, instead of what you typed, and will change if you click a link.
Custom buttons .
Favorites!
Bugs:
Full screen youtube and the like don't accept the escape key.
Source:
Form One (the actual browser):
Code:
Public Class Form1
Dim Homepage As Uri
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
My.Settings.F2 = False
My.Settings.F3 = False
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Homepage = My.Settings.Homepage
My.Settings.F2 = False
My.Settings.F3 = False
If Not Homepage = Nothing Then
WebBrowser1.Navigate(Homepage)
If Not My.Settings.HPURL = Nothing Then
TextBox1.Text = My.Settings.HPURL.ToString
End If
Else
WebBrowser1.Navigate("www.google.com")
TextBox1.Text = "www.google.com".ToString
End If
Me.Text = "SandBrowser - " & WebBrowser1.DocumentTitle
TextBox1.AcceptsReturn = True
If Not (My.Settings.URL.Count = Nothing) Then
For i = 1 To (My.Settings.URL.Count - 1)
tlsFaves.DropDownItems.Add(My.Settings.URL.Item(i), Nothing, AddressOf Clicked)
Next
End If
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Me.Text = "SandBrowser - " & WebBrowser1.DocumentTitle
TextBox1.Text = WebBrowser1.Url.ToString
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
Private Sub Back_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Back.Click
If WebBrowser1.CanGoBack Then
WebBrowser1.GoBack()
End If
End Sub
Private Sub Forward_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Back.Click
If WebBrowser1.CanGoForward Then
WebBrowser1.GoForward()
End If
End Sub
Private Sub GoToYourHomepageToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoToYourHomepageToolStripMenuItem.Click
If Not My.Settings.Homepage = Nothing Then
WebBrowser1.Navigate(My.Settings.Homepage)
Else
WebBrowser1.GoHome()
End If
End Sub
Private Sub UseCurrentPageToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UseCurrentPageToolStripMenuItem.Click
Homepage = WebBrowser1.Url
My.Settings.Homepage = Homepage
My.Settings.HPURL = WebBrowser1.Url
End Sub
Private Sub Home_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Home.Click
GoToYourHomepageToolStripMenuItem.PerformClick()
End Sub
Private Sub Forward_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Forward.Click
If WebBrowser1.CanGoForward Then
WebBrowser1.GoForward()
End If
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Not TextBox1.Text = "" Then
If e.KeyChar = Chr(13) Then
Button1.PerformClick()
End If
End If
End Sub
Private Sub UseACustomPageToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UseACustomPageToolStripMenuItem.Click
Dim SecondForm As New Form2
If My.Settings.F2 Then
SecondForm.Focus()
Else
SecondForm.Show()
My.Settings.F2 = True
End If
End Sub
Private Sub ViewCreditsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ViewCreditsToolStripMenuItem.Click
Dim ThirdForm As New Credits
If My.Settings.F3 Then
ThirdForm.Focus()
Else
ThirdForm.Show()
My.Settings.F3 = True
End If
End Sub
Sub Clicked(ByVal site As System.Object, ByVal e As System.EventArgs)
WebBrowser1.Navigate(site.ToString)
TextBox1.Text = site.ToString
End Sub
Private Sub BookmarkThisPageToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BookmarkThisPageToolStripMenuItem.Click
tlsFaves.DropDownItems.Add(WebBrowser1.Url.ToString, Nothing, AddressOf Clicked)
My.Settings.URL.Add(WebBrowser1.Url.ToString)
End Sub
End Class
Form two (Custom home page set up):
Code:
Public Class Form2
Private Sub F2ChangeHP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles F2ChangeHP.Click
If InStr(HPURL.Text, "http://") = 0 Then
If InStr(HPURL.Text, "www.") = 0 Then
HPURL.Text = "http://www." & HPURL.Text
Else
HPURL.Text = "http://" & HPURL.Text
End If
End If
Dim HP As New Uri(HPURL.Text)
If HPURL.Text <> "" Then
My.Settings.Homepage = HP
My.Settings.HPURL = HP
HPURL.Text = ""
Me.Hide()
End If
End Sub
End Class
Form three (credits):
Code:
Public Class Form3
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Hide()
End Sub
End Class
Post any opinions, ideas, help, whatever you think I could do to improve it. Just starting to learn Visual Basic, so yea :P.
Download link, file is to big to attach:
http://www.megaupload.com/?d=0P0YNUCF
~Sandstorm