Lost Password?

  #1 (permalink)  
Old 09-10-2007, 02:55 AM
travy92's Avatar   
travy92 travy92 is offline
Learning Programmer
 
Join Date: Sep 2007
Location: Australia
Age: 15
Posts: 71
Rep Power: 4
travy92 is on a distinguished road
Send a message via MSN to travy92
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.

Quote:
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...)

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

Quote:
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.

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

Quote:
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.

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

Quote:
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).

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

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

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

Quote:
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:

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

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

Add this in:

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

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

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

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

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

Quote:
'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.

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

Quote:
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.

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

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

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

Quote:
'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.

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

Quote:
'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:

Quote:
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:
Quote:
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:
Quote:
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:
Quote:
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 To view attachments your post count must be 1 or greater. Your post count is 0 momentarily.

Last edited by Jordan; 09-10-2007 at 08:22 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 09-10-2007, 03:16 AM
TcM's Avatar   
TcM TcM is offline
Moderator
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 7,329
Rep Power: 66
TcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud of
Default

Thanks for the Credits and now your screen shots are way better
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-10-2007, 03:31 AM
travy92's Avatar   
travy92 travy92 is offline
Learning Programmer
 
Join Date: Sep 2007
Location: Australia
Age: 15
Posts: 71
Rep Power: 4
travy92 is on a distinguished road
Send a message via MSN to travy92
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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-03-2007, 03:40 AM
codeman123 codeman123 is offline
Newbie
 
Join Date: Nov 2007
Posts: 1
Rep Power: 0
codeman123 is on a distinguished road
Default

thaaaaanks
nice work
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 12-08-2007, 09:34 AM
vonhell vonhell is offline
Newbie
 
Join Date: Dec 2007
Posts: 1
Rep Power: 0
vonhell is on a distinguished road
Default

Great program thank
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 01-13-2008, 11:40 AM
$RaMRoM$ $RaMRoM$ is offline
Newbie
 
Join Date: Oct 2007
Posts: 6
Rep Power: 0
$RaMRoM$ is on a distinguished road
Default

I love this tutorial, Thanks a lot!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-15-2008, 12:13 PM
GnBz GnBz is offline
Newbie
 
Join Date: Jan 2008
Posts: 3
Rep Power: 0
GnBz is on a distinguished road
Default

looks cool i will cheak it out
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-24-2008, 11:11 AM
juelpatwary juelpatwary is offline
Newbie
 
Join Date: Jan 2008
Posts: 1
Rep Power: 0
juelpatwary is on a distinguished road
Default

Truely great, Thanks...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-17-2008, 09:10 PM
Colin5555 Colin5555 is offline
Newbie
 
Join Date: Feb 2008
Posts: 1
Rep Power: 0
Colin5555 is on a distinguished road
Thumbs up

Great Tutorial, thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
John's Java Tutorial Index John Java Tutorials 0 01-11-2007 03:05 PM
Tutorial to Remove the Virus "Trojan horse Startpage.ADE" clookid Tutorials 9 01-09-2007 09:39 PM
Tutorial: Proxy Servers Lop Tutorials 7 01-02-2007 03:53 AM
Reduce your temporary internet file space PC101 Technology Ramble 4 10-04-2006 09:29 PM


All times are GMT -5. The time now is 03:35 AM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
LogicKills ........ 20.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 67%

Ads