Page 1 of 2 12 LastLast
Results 1 to 25 of 37

Thread: SandBrowser, a basic Web Browsing Application!

  1. #1
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default SandBrowser, a basic Web Browsing Application!

    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 Sandstorm; 09-07-2009 at 02:21 PM.

  2. #2
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Simple, but good for vb, I can't even give it a look.
    ~Hermen

  3. #3
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yea, I'm hoping to add in favorites, home page, and the like, but I have to figure out saving and loading from files first :P.

    ~Sandstorm

  4. #4
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Use XML or Ini file's they are easy enough for that kind of job.
    ~Hermen

  5. #5
    Join Date
    Jul 2009
    Posts
    421
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sandstorm View Post
    Yea, I'm hoping to add in favorites, home page, and the like, but I have to figure out saving and loading from files first :P.

    ~Sandstorm
    I could help with that, was version of VB are you using?
    Quote Originally Posted by Cstrike View Post
    Why do I even try these things? I just shit my pants over this god damn tutorial. Fuck, that's uncleanable. I can't even wash that out because there's so much of my shit it will just stain everything else. If I put it in the washing machine, I'm sure to stain the sides.

  6. #6
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Microsoft Visual Basic 2008 EE. First one I found xD.

    ~Sandstorm

  7. #7
    Join Date
    Jul 2009
    Posts
    421
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sandstorm View Post
    Microsoft Visual Basic 2008 EE. First one I found xD.

    ~Sandstorm
    What types of file(s) do you wish to load?
    Quote Originally Posted by Cstrike View Post
    Why do I even try these things? I just shit my pants over this god damn tutorial. Fuck, that's uncleanable. I can't even wash that out because there's so much of my shit it will just stain everything else. If I put it in the washing machine, I'm sure to stain the sides.

  8. #8
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Neehosoft View Post
    What types of file(s) do you wish to load?
    Quote Originally Posted by Sandstorm View Post
    Yea, I'm hoping to add in favorites, home page, and the like, but I have to figure out saving and loading from files first :P.

    ~Sandstorm
    Figure out what one is the best .
    ~Hermen

  9. #9
    Join Date
    Jul 2009
    Posts
    421
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Hermen View Post
    Figure out what one is the best .
    ooh lol. Well then you should probably store it all in a file under a user folder with a some xml files that store the variables "homepage" and favorites in a nice list. When i used to have a vb web browser i even made a customized themeing option that loaded from the xml
    Quote Originally Posted by Cstrike View Post
    Why do I even try these things? I just shit my pants over this god damn tutorial. Fuck, that's uncleanable. I can't even wash that out because there's so much of my shit it will just stain everything else. If I put it in the washing machine, I'm sure to stain the sides.

  10. #10
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I was thinking of just doing this (scar example):

    SCAR Code:
    Procedure Savehome;
    Begin
      Writeini(path, 'home', 'page', URL);
    End;

    Procedure Loadhome;
    Begin
      Homepage := Readini(path, 'home', 'page');
    end;

    Sort of like that. Not sure how I'd do it in VB though (the saving and loading, variable assignment is a snap).

    And do the same thing for the favorites - teach me to save and load files and I can do the rest fine, if rather messily xD.

    ~Sandstorm

  11. #11
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    In VB you can use the My.Settings feature and have the values written into the assembly form inside the exe. Checkout: http://msdn.microsoft.com/en-us/libr...8VS.80%29.aspx



    ~NS

  12. #12
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks, but that doesn't help much. I've found like five tutorials on it, but they all assume knowledge of the coding, and so it looks like a big jumble to me .

    ~Sandstorm

  13. #13
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sandstorm View Post
    Thanks, but that doesn't help much. I've found like five tutorials on it, but they all assume knowledge of the coding, and so it looks like a big jumble to me .

    ~Sandstorm
    Don't give up!
    I just don't code Visual Basic .
    ~Hermen

  14. #14
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yea, I'm still looking around, but the future looks bleak at this point in time .

    ~Sandstorm

  15. #15
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Button1_Click(Me, EventArgs.Empty)

    Do this instead: Button1.PerformClick

    Also, you don't need that. Just set the Form's AcceptButton to Button1.

    Also, give the controls names that you can remember, such as btnGo, txtURL, etc.

  16. #16
    Join Date
    Oct 2006
    Posts
    500
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sandstorm View Post
    Yea, I'm still looking around, but the future looks bleak at this point in time .

    ~Sandstorm
    Don't give up!
    The My.Settings feature is actually pretty easy to use once you understand it. I'll make an easy to follow tutorial for you.

  17. #17
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    @TViYH - Cool, that's what I originally tried to do, but couldn't find it :P.

    @R!ch!e - Wow, thanks! And yea, most things are easy - once you understand them.

    ~Sandstorm

  18. #18
    Join Date
    Oct 2006
    Posts
    500
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  19. #19
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Perfect! So much easier to understand. Home page is working now. Just gotta figure out the favorites, and I'll release this next one.

    ~Sandstorm

  20. #20
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Home page now works - try to crash it through the use of the custom home page please! I need to know if anything has to be added to make it crash-proof.

    Fixed that damn forward button :P.

    Fixed search engines such as google and youtube not working. You'd press enter and it would just refresh the page.

    Fixed the url area - it'll now change the url based on the page.

    Tell me what you think, and any bugs!

    ~Sandstorm

  21. #21
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    2,240
    Mentioned
    3 Post(s)
    Quoted
    11 Post(s)

    Default

    Visual Basic? No thnx no one uses that
    Click here to find out how to get full screen without members! | Click here to check out my Ultimate Bitmap Tutorial! Edited to work with Simba! |

  22. #22
    Join Date
    Jul 2009
    Posts
    421
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by cycrosism View Post
    Visual Basic? No thnx no one uses that
    dont hate vb just becuase your ubuntu?
    Quote Originally Posted by Cstrike View Post
    Why do I even try these things? I just shit my pants over this god damn tutorial. Fuck, that's uncleanable. I can't even wash that out because there's so much of my shit it will just stain everything else. If I put it in the washing machine, I'm sure to stain the sides.

  23. #23
    Join Date
    Oct 2006
    Posts
    500
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by cycrosism View Post
    Visual Basic? No thnx no one uses that
    Why bother posting or even looking in the VB section if "no one" uses it?

    Sandstorm, it looks much better now. Just a quick thing I noticed, when you use the home page button you should make it update the Address Bar, as it remains as the previously visited URL.

  24. #24
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by r!ch!e View Post
    Why bother posting or even looking in the VB section if "no one" uses it?

    Sandstorm, it looks much better now. Just a quick thing I noticed, when you use the home page button you should make it update the Address Bar, as it remains as the previously visited URL.
    I put that in the page load trigger?

    Added custom buttons and changed the background.

    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
    Last edited by Sandstorm; 09-07-2009 at 02:22 PM.

  25. #25
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    2,240
    Mentioned
    3 Post(s)
    Quoted
    11 Post(s)

    Default

    No I am just saying in the programming industry no one uses visual basic. This has nothing to do with the fact I use ubuntu.
    Click here to find out how to get full screen without members! | Click here to check out my Ultimate Bitmap Tutorial! Edited to work with Simba! |

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •