Solved

web browser control in VB 5.0

Posted on 1998-06-05
7
175 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
  • 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now