Solved

web browser control in VB 5.0

Posted on 1998-06-05
7
180 Views
Last Modified: 2008-02-01
Hi,
I have a web browser control on my form and i need to implement the Back and Forward buttons. can somebody direct me as to how to go about it? any sample code will be highly appreciated.
thanks in advance,
vmano
0
Comment
Question by:vmano
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 6

Accepted Solution

by:
clifABB earned 50 total points
ID: 1462636
Add to command buttons on your form.

Call one cmdBack, the other cmdForward
Add the following code to each button:
Private Sub cmdBack_Click()

  WebBrowser1.GoBack
End Sub

Private Sub cmdForward_Click()

  WebBrowser1.GoForward
End Sub

0
 
LVL 3

Author Comment

by:vmano
ID: 1462637
when i first load the form with a specific URL address (with navigate method) and if i click the Back button it is giving me an error as there is no URL address to go back. where will i check for that? i know you can check in the history folder but how? can you send me the code for checking in the history folder???
thanks in advence,
vmano.
0
 
LVL 3

Author Comment

by:vmano
ID: 1462638
basically i need to enable and disable the back and forward buttons depending on the user navigation. hope you got what i am trying to say. if you have further questions please post a comment and i will be happy to answer that.
thanks,
vmano
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:clifABB
ID: 1462639
I haven't found any examples of checking the history folder, though I do remember that it was suggested you could at VBITS.

The following is the same as the code in my answer, with Error trapping:
Const ERR_NAVIGATE = &H80004005&

Private Sub cmdBack_Click()

  On Error GoTo HandleIt
  WebBrowser1.GoBack
  Exit Sub
 
HandleIt:
  If Err.Number = ERROR_NAVIGATE Then
    MsgBox "Nothing to go back to."
    Resume Next
  EndIf
  Resume Next
End Sub

Private Sub cmdForward_Click()

  On Error GoTo HandleIt
  WebBrowser1.GoForward
  Exit Sub
 
HandleIt:
  If Err.Number = ERROR_NAVIGATE Then
    MsgBox "Nothing to go forward to."
    Resume Next
  EndIf
  Resume Next
End Sub

0
 
LVL 6

Expert Comment

by:clifABB
ID: 1462640
Your second comment was posted while I was writing mine.

As I said in my last comment, I couldn't find any examples of reading the history folder.

I'm sorry I couldn't help you there.
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1462641
I found, on Microsoft's web site, the 'missing' documentation for the WebBrowser.  It's located at:
http://www.microsoft.com/msdn/sdk/inetsdk/help/itt/IEProg/WB/Objects/WebBrowser.htm#WebBrowser 
Although it's not downloadable, it still gives some fairly useful information (no examples, though).

0
 
LVL 3

Author Comment

by:vmano
ID: 1462642
Hi CliffABB,
previously i visited the web site which you sent me today. but same thing. i could not find any useful material.  
right now, i am able to get on with your code. it owrks great. thanks for your help.  and i really appreciate it.
thanks and here are your points and grade,
vmano

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MsgBox 2 61
Run code from text file in vb 1 87
VB6 - Compare and highlight cell not the same 3 56
clicking a shape in a frame array vb6 3 48
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question