| SandBrowser, a basic Web Browsing Application! |
 |

09-06-2009, 05:50 AM
|
|
Forum Addict
|
|
Join Date: Jul 2007
Posts: 493
|
|
SandBrowser, a basic Web Browsing Application!
I did NOT write the html parsing, it was all included with my download of MVB2008 EE.
This is for my learning purposes only. It's not really meant to be a functional browser, although you could if you wanted to. Please do not post something like this:
"Oh, that sucks, so easy, could do it in five minutes"
That's not the point of this - I'm trying to learn >.<. Had a couple of those at RSBot.
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
Last edited by Hey321 : 09-07-2009 at 07:26 AM.
|

09-06-2009, 02:23 PM
|
|
Guru
BANNED
|
|
Join Date: Jun 2008
Location: ALWAYS GET A PM (UK)
Posts: 1,778
|
|
Re: SandBrowser, a basic Web Browsing Application!
Can you post some pictures? I want to see your designing 
|

09-06-2009, 04:36 PM
|
|
Forum Addict
|
|
Join Date: Jul 2007
Posts: 493
|
|
Re: SandBrowser, a basic Web Browsing Application!
You could always just download it, but alright...
~Sandstorm
|

09-06-2009, 09:35 PM
|
|
Forum Addict
|
|
Join Date: Jul 2007
Posts: 493
|
|
Re: SandBrowser, a basic Web Browsing Application!
Added custom buttons and a background. Don't feel like screwing with pictures again, if someone would scan it, you guys'll know it's safe to download and look at it on your own?
~Sandstorm
|

09-07-2009, 07:27 AM
|
|
Forum Addict
|
|
Join Date: Jul 2007
Posts: 493
|
|
Re: SandBrowser, a basic Web Browsing Application!
After four or five hours of pondering, testing, fixing, testing some more, and tweaking bugs, I introduce to you:
Favorites! As yet they can't be removed, but this is being worked on.
~Sandstorm
|

09-07-2009, 07:31 AM
|
 |
When They Cry...
|
|
Join Date: Jan 2007
Location: Japan
Posts: 4,404
|
|
Re: SandBrowser, a basic Web Browsing Application!
Quote:
Originally Posted by Hey321
After four or five hours of pondering, testing, fixing, testing some more, and tweaking bugs, I introduce to you:
Favorites! As yet they can't be removed, but this is being worked on.
~Sandstorm
|
Err... All favourites are is a list. Hours, you say?
__________________
Quote:
[14:54:13] <&Filefragg> x9 is made of 5 glow in the dark gorilla dildos vibrating in unison.
[14:54:19] <%TDD> hot
[14:54:22] <+Aoi> Win
[14:54:23] <x9> I TOLD YOU NOT TO TELL ANYONE, DAMNIT
|
|

09-07-2009, 08:12 AM
|
|
Forum Addict
|
|
Join Date: Jul 2007
Posts: 493
|
|
Re: SandBrowser, a basic Web Browsing Application!
Quote:
Originally Posted by Swan
Err... All favourites are is a list. Hours, you say?
|
Navigating to them on clicking them, as well as saving and loading them was hard. This is essentially my first visual basic project, I'm learning everything as I go.
~Sandstorm
|

09-07-2009, 10:33 PM
|
 |
i am a guy ok?? -.-
|
|
Join Date: Nov 2006
Location: Canada
Posts: 5,232
|
|
Re: SandBrowser, a basic Web Browsing Application!
Quote:
Originally Posted by Hey321
Navigating to them on clicking them, as well as saving and loading them was hard. This is essentially my first visual basic project, I'm learning everything as I go.
~Sandstorm
|
Well, you could store favorites as an array in either the My namespace settings or by saving them to a file/registry. Also, for the navigation part, just make 2 lists, one that is invisible (or simply another array) which stores the URLs, then another which stores the Favorite names. Then, all you need to do is deal with indexes of the array and the list so that the URL corresponds to the selected title in the favorites list, then once it's clicked, navigate to the selected item in the URL array. Hope that helped 
|

09-07-2009, 10:46 PM
|
|
Forum Addict
|
|
Join Date: Jul 2007
Posts: 493
|
|
Re: SandBrowser, a basic Web Browsing Application!
They already work, just need to add one last thing to it.
During runtime I create a dropdown list button, and a sub button to that. If the sub button is clicked, I need to be able to know what the dropdown list button is. Any ideas?
~Sandstorm
|
 |
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|