Solved

web browser control in VB 5.0

Posted on 1998-06-05
7
178 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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 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…
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…

770 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