Solved

Getting WebBrowser controls history

Posted on 2004-09-08
9
392 Views
Last Modified: 2008-02-01
Hi,

Im using a WebBrowser control within VB6...I have back and forward buttons just like in IE..however, i want to disable the back, or forward buttons within the menu if the WebBrowsers history is empty...in javascript it is obviously history.length ....is there anyway i can either return this value to my vb app, or use my own VB call to get the windows history????

Also, anyone any idea how to disable an item in a VB 6 menu, i dont see that the menu has any object name i can refer to???

Thanks

al
0
Comment
Question by:higgsy
  • 6
  • 3
9 Comments
 
LVL 32

Accepted Solution

by:
Erick37 earned 500 total points
ID: 12009763
From MS:

"The WebBrowser control supports a CommandStateChange event, which is fired whenever the Forward or Back buttons need to be enabled or disabled. "

http://support.microsoft.com/default.aspx?scid=kb;EN-US;163282

' A Visual Basic application can also implement this
' functionality in this manner:  

Private Sub WebBrowser_CommandStateChange(ByVal Command As Long,ByVal Enable As Boolean)

       Select Case Command
           Case CSC_NAVIGATEBACK
               Back.Enabled = Enable
           Case CSC_NAVIGATEFORWARD
               Forward.Enabled = Enable
       End Select

End Sub
0
 
LVL 32

Expert Comment

by:Erick37
ID: 12009806
oops...

Here are the constants:

Private Const CSC_NAVIGATEFORWARD As Long = 1
Private Const CSC_NAVIGATEBACK As Long = 2
0
 

Author Comment

by:higgsy
ID: 12009865
Hi Erick,

That seems to work great, however what does Back.Enabled and Forward.Enabled refer to .... i just ran this code and it crashes due to the fact that there are no objects called Back or Forward in my App...

Should this refer to the menu item name??
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

Author Comment

by:higgsy
ID: 12009881
Hi Erick,

Ive tried changing it o the name of my menu item and it works great....thanks...

Do u know how to add an icon into any menu item???
0
 
LVL 32

Expert Comment

by:Erick37
ID: 12009980
Right, replace Back.Enabled to [the name of your back button].enabled

>>Do u know how to add an icon into any menu item???
Some links for you:
http://www.ilook.fsnet.co.uk/vb/vbmnicon.htm
http://www.thescarms.com/vbasic/ClearForm.asp
0
 
LVL 32

Expert Comment

by:Erick37
ID: 12010051
And another good one which uses an ImageList control to store the bitmaps:

http://www.freevbcode.com/ShowCode.asp?ID=6533
0
 

Author Comment

by:higgsy
ID: 12010068
Top stuff Erick....

Thanks mate
0
 
LVL 32

Expert Comment

by:Erick37
ID: 12058457
You're welcome, glad it worked out for you.
0
 
LVL 32

Expert Comment

by:Erick37
ID: 12123686
Looking forward to an "A" when you get the chance.

Thanks!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

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