+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 10 of 15

Thread: Tutorial - An Internet browser!

  1. #1
    Learning Programmer travy92 will become famous soon enough travy92's Avatar
    Join Date
    Sep 2007
    Location
    Australia
    Age
    17
    Posts
    73

    Post Tutorial - An Internet browser!

    INTRODUCTION

    Well basically i've been playing around with a few functions i've learned through other tutorials and i'd like to make a tutorial on making an internet browser with history saving & Menu.

    -------------------------------------------------------------------
    GUI (LAYOUT)
    Here is my GUI:


    -------------------------------------------------------------------

    What you need:

    6 Command buttons with the following Names/Captions:

    Command Button #1:
    Name: cmdHome
    Caption: Home

    Command Button #2
    Name: cmdBack
    Caption: Back

    Command Button #3
    Name: cmdForward
    Caption: Forward

    Command Button #4
    Name: cmdStop
    Caption: Stop

    Command Button #5
    Name: cmdRefresh
    Caption: Refresh

    Command Button #6
    Name: cmdGo
    Caption: Go

    1 ComboBox with the following Name/Caption
    (Caption is the same as Text... Just find "Text" in the properties window):
    Name: cboURL
    Caption/Text: (Nothing)

    1 Label with the following Name/Caption:

    Name: lbCaption
    Text: Address:

    1 Web Browser with the following Name:

    Now for the web browser, you'll need to add the component:
    "Microsoft Internet Controls" You can get to the components window by press CTRL+T on the keyboard, then scroll down and tick "Microsoft Internet Controls".

    After doing the above procedures, there should be a new item on the list of the tool bar. It looks like the Earth. Now click on it and drag it onto your Form, make it big because it's what you'll be using to view pages with.. Use this Name:
    Name: wWeb

    If you're having problems like an error when you click "Microsoft Internet Controls" just PM me and i'll help you out.
    ----------------------------------------------------------------

    CODE WITH EXPLANATIONS!

    Add this code to cmdHome button (Double click on the Home button to bring up code window.

    Private Sub cmdHome_Click()
    wWeb.GoHome
    End Sub
    This makes the web browser (wWeb) go to the home page when you click the "Home" button.
    (The home page for me is Google, i think it jsut uses your other browser's home page...)

    ----------------------------------------------------------------

    Private Sub cmdBack_Click()
    wWeb.GoBack
    End Sub
    This makes the web browser (wWeb) go to the previous page whenever you click the "Back" button.

    ----------------------------------------------------------------

    Private Sub cmdForward_Click()
    wWeb.GoForward
    End Sub
    This code instructs the web browser to go to the subsequent page when you click the "Forward" button.

    ----------------------------------------------------------------

    Private Sub cmdGo_Click()
    wWeb.Navigate (cboURL.Text)
    cboURL.AddItem (cboURL.Text)
    End Sub
    Okay, it's getting a bit harder now.
    The above code makes the web browser (wWeb) go to the page specified by the cboURL box (ComboBox).
    AND also whatever is entered into the cboURL box is also added to the drop down arrow box (like history).

    ----------------------------------------------------------------

    Private Sub cmdRefresh_Click()
    wWeb.Refresh
    End Sub
    This refreshes the web browser when you click the "Refresh" button.

    ----------------------------------------------------------------

    Private Sub cmdStop_Click()
    wWeb.Stop
    End Sub
    This code stops the web browser in it's tracks! Basically just stopping it from loading any further.

    ----------------------------------------------------------------

    MENU + CODES

    Ok to add a menu to the form you need to go to Tools>Menu Editor or just press CTRL+E.

    A window like this will pop-up:



    Now add the following in:

    Caption: File
    Name: mnuFile
    ----------------
    Then press "Next"

    And then press the Right-Arrow key to make the 3 dots appear:

    Add this in:

    Caption: Print
    Name: mnuFilePrint
    ------------------
    Then press "Next"
    (Let 3 dots appear):

    Caption: Exit
    Name: mnuFileExit
    ------------------
    Press "Next" again.
    (This time take away the 3 dots by pressing the left arrow key)

    Caption: Edit
    Name: mnuEdit
    ----------------
    Press the "Next" button again!
    (And make the 3 dots appear again by pressing the right-arrow key)

    Caption: Move
    Name: mnuEditMove
    ---------------------
    Press the "Next" button again!
    (Keep the 3 dots):

    Caption: Resize
    Name: mnuEditResize
    ----------------------
    MENU CODE

    'Invoke PrintForm method for this Form (Me)
    'Sends image of Form to printer - useful for hardcopy
    Private Sub mnuFilePrint_Click()
    Me.PrintForm
    End Sub
    Basically just prints off the page.

    ----------------------------------------------------------------

    Private Sub cboURL_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then
    wWeb.Navigate cboURL.Text
    End If
    End Sub
    This is an essential code to make the "History" function work.. It makes history work.. Lol.

    ----------------------------------------------------------------

    Private Sub mnuFileExit_Click()
    End
    End Sub
    Closes the program.

    ----------------------------------------------------------------

    'Invoke Move method for this Form (Me)
    'Look at Form object --> Methods in Help
    Private Sub mnuEditMove_Click()
    Me.Move 0, 0

    End Sub
    Moves the program window.

    ----------------------------------------------------------------

    'Parameters of move are: left edge, top edge, width, height
    'Measurements in twips (see Lesson 7)
    Private Sub mnuEditResize_Click()
    Me.Move 6000, 6000, 6000, 5000
    End Sub
    Resizes the program.


    And if you're lazy and just want the full code:

    Private Sub cboURL_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then
    wWeb.Navigate cboURL.Text
    End If
    End Sub

    Private Sub cmdBack_Click()
    wWeb.GoBack
    End Sub

    Private Sub cmdForward_Click()
    wWeb.GoForward
    End Sub

    Private Sub cmdGo_Click()
    wWeb.Navigate (cboURL.Text)
    cboURL.AddItem (cboURL.Text)
    End Sub

    Private Sub cmdHome_Click()
    wWeb.GoHome
    End Sub

    Private Sub cmdRefresh_Click()
    wWeb.Refresh
    End Sub

    Private Sub cmdStop_Click()
    wWeb.Stop
    End Sub

    Private Sub Form_Load()

    Dim Response As Integer



    Response = MsgBox("Open Program?", vbInformation + vbYesNo, "Are you sure?")



    If Response = vbYes Then
    MsgBox "Welcome to Trav's Internet Explorer!"
    Load Me

    ElseIf Response = vbNo Then

    Me.Refresh

    End If



    End Sub


    Private Sub Form_Unload(Cancel As Integer)
    Dim Response As Integer



    Response = MsgBox("Exit Program?", vbInformation + vbYesNo, "Are you sure?")



    If Response = vbYes Then
    MsgBox "Thankyou for using Trav's Internet Explorer!"
    Unload Me

    ElseIf Response = vbNo Then

    Me.Refresh

    End If



    End Sub


    'Invoke Move method for this Form (Me)
    'Look at Form object --> Methods in Help
    Private Sub mnuEditMove_Click()
    Me.Move 0, 0

    End Sub

    'Parameters of move are: left edge, top edge, width, height
    'Measurements in twips (see Lesson 7)
    Private Sub mnuEditResize_Click()
    Me.Move 6000, 6000, 6000, 5000
    End Sub

    Private Sub mnuFileExit_Click()
    End
    End Sub

    'Invoke PrintForm method for this Form (Me)
    'Sends image of Form to printer - useful for hardcopy
    Private Sub mnuFilePrint_Click()
    Me.PrintForm
    End Sub
    ----------------------------------------------------------------

    EXTRA

    You can also add extra message boxes to the exit buttons just in case you accidentally press Exit.

    Here is the code:
    Private Sub mnuFileExit_Click()
    Dim Response1 As Integer



    Response1 = MsgBox("Exit Program?", vbInformation + vbYesNo, "Are you sure?")



    If Response1 = vbYes Then
    MsgBox "Thankyou for using Trav's Internet Explorer."
    Unload Me

    ElseIf Response1 = vbNo Then

    Me.Refresh

    End If
    End Sub
    ----------------------------------------------------------------

    Or:
    Private Sub Form_Unload(Cancel As Integer)
    Dim Response As Integer



    Response = MsgBox("Exit Program?", vbInformation + vbYesNo, "Are you sure?")



    If Response = vbYes Then
    MsgBox "Thankyou for using Trav's Internet Explorer!"
    Unload Me

    ElseIf Response = vbNo Then

    Me.Refresh

    End If



    End Sub
    ----------------------------------------------------------------

    Or jsut simply:
    End
    (Put this code between the Private Sub "?"_Click ()
    and End)
    (The "?" stands for the button name... Put the button name in, whatever it is)

    ----------------------------------------------------------------

    THANKS:

    Thanks to Tcm9669 for the original Screenshot program.
    Thanks to TheComputerMaster for the updated "hidden" version of the Screenshot program.

    And thanks to you for taking the time to read this awfully long tutorial.

    This tutorial was made by me, Travy92.

    Samples!! WOOH!:
    Attached Files
    Last edited by Jordan; 09-10-2007 at 08:22 AM.

  2. #2
    TcM
    TcM is offline
    Code Warrior TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM's Avatar
    Join Date
    Aug 2006
    Posts
    11,461
    Blog Entries
    6
    Thanks for the Credits and now your screen shots are way better

  3. #3
    Learning Programmer travy92 will become famous soon enough travy92's Avatar
    Join Date
    Sep 2007
    Location
    Australia
    Age
    17
    Posts
    73

    Smile

    Quote Originally Posted by TheComputerMaster View Post
    Thanks for the Credits and now your screen shots are way better
    Yeah no problems! I agree, my screenshots are way better!

  4. #4
    Newbie codeman123 is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    1
    thaaaaanks
    nice work

  5. #5
    Newbie vonhell is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    1
    Great program thank

  6. #6
    Newbie $RaMRoM$ is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    6
    I love this tutorial, Thanks a lot!

  7. #7
    Newbie GnBz is an unknown quantity at this point
    Join Date
    Jan 2008
    Posts
    3
    looks cool i will cheak it out

  8. #8
    Newbie juelpatwary is an unknown quantity at this point
    Join Date
    Jan 2008
    Posts
    1
    Truely great, Thanks...

  9. #9
    Newbie Colin5555 is an unknown quantity at this point
    Join Date
    Feb 2008
    Posts
    1

    Thumbs up

    Great Tutorial, thanks

  10. #10
    Newbie miamia is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    1

    Re: Tutorial - An Internet browser!

    great!

+ Reply to Thread
Page 1 of 2
1 2 LastLast

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. John's Java Tutorial Index
    By John in forum Java Tutorials
    Replies: 0
    Last Post: 01-11-2007, 03:05 PM
  2. Replies: 9
    Last Post: 01-09-2007, 09:39 PM
  3. Tutorial: Proxy Servers
    By Lop in forum Tutorials
    Replies: 7
    Last Post: 01-02-2007, 03:53 AM
  4. Reduce your temporary internet file space
    By PC101 in forum Technology Ramble
    Replies: 4
    Last Post: 10-04-2006, 09:29 PM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

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