Creating a web browser


So there isn't many visual basics tutorials so why not write one myself??? So open up VB6 and create a new project with 1 form!

Now create 5 command buttons call them
  • cmdforward
  • cmdback
  • cmdstop
  • cmdrefresh
  • cmdgo


Label them as you want!
Now create a combo box and call it cburl!

Now right click where all the components are and click components then go down to Microsoft internet control! Draw the web browser and call this web

Use the following codes to make your browser work:
If you don't know what to do double click on the back button and put in
web.GoBack

These are the rest of the codes DONT INCLUDE THE CMD STUFF

VB Code
  1. cmrefresh = web.Refresh

VB Code
  1. cmback = web.GoBack

VB Code
  1. cmforward = web.Forward

VB Code
  1. cmstop = web.Stop

VB Code
  1. cmgo = web.navigate (cburl.Text)


Now that's about it for your basic web browser I will be adding more addons soon!
MOD-Dan's Avatar
Author:
Views:
3,084
Rating:
Posted on Saturday 21st July 2007 at 02:53 PM
ShadowMage
ShadowMage's Avatar
i've faced that to :P under add/remove windows components in Add or remove programs, uncheck IE then it may work ^^
Posted on Saturday 21st July 2007 at 11:37 AM
Joshua
Joshua's Avatar
I'm wondering, what if you have a "File not found: IEFrame.DLL/1" I can't seem to fix it, I've googled it and it said re-download Internet Explorer, which I have just done, but it's still messing up, any suggestions?

{{I need it fixed because I am working on a RMB Browser}}
Posted on Thursday 12th July 2007 at 07:00 PM
FtH8er
FtH8er's Avatar
Sorry I messed it up it needs to be like this:::

Code
Private Sub back_Click()
On Error GoTo ErrorHandler

WebBrowser1.GoBack ' Back
Exit Sub 'Forgot This Part, Without This You Would Get The Error Message Everytime

ErrorHandler:
MsgBox "You Can Not Go Back Before You Go To At Least 2 Pages", vbOKOnly, "Browser Error"

End Sub


Sorry Bout That, Plus I didnt use the code box lol
Posted on Thursday 12th July 2007 at 06:48 PM
FtH8er
FtH8er's Avatar
umm ya that would be like this:

Private Sub back_Click()
On Error GoTo ErrorHandler

WebBrowser1.GoBack ' Back

ErrorHandler:
MsgBox "You Can Not Go Back Before You Go To At Least 2 Pages", vbOKOnly, "Browser Error"

End Sub


Should be like that
Posted on Thursday 12th July 2007 at 06:17 PM
vb_king
vb_king's Avatar
I have a question, is it possible for it to give an alert instead of giving an error when you click back before 2 pages?
Posted on Thursday 12th July 2007 at 01:01 PM
vb_king
vb_king's Avatar
nvm joe told me its cuz i have to go atleast 2 pages for the Back and Forward buttons to work.
Posted on Thursday 12th July 2007 at 06:55 AM
MOD-Dan
MOD-Dan's Avatar
try putting GoForward
Posted on Wednesday 11th July 2007 at 10:21 PM
FtH8er
FtH8er's Avatar
and there is nothing that is named IWebBrowser2 in your document??
Posted on Wednesday 11th July 2007 at 10:16 PM
vb_king
vb_king's Avatar
I keep getting this error whenever i click Back or Forward... Method "GoBack" of "IWebBrowser2" failed and same thing but its "Forward" when i click Forward. and the name of the browser isnt IWebBrowser2 its web
Posted on Saturday 9th June 2007 at 05:11 PM
mrlee992
mrlee992's Avatar
It's so simple!

I at first thought it was hard, But i realised it was simple!

Mr. Lee Inc.