Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

web browser control in VB 5.0

Posted on 1998-06-05
7
Medium Priority
?
199 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 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
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.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month21 days, 2 hours left to enroll

810 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