?
Solved

web browser control in VB 5.0

Posted on 1998-06-05
7
Medium Priority
?
196 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 200 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

649 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