I'm making a webbrowser just so everyone knows....ya know..the easy stuff, and i was wondering how you would make the forward button disabled when you cant go forward.
Printable View
I'm making a webbrowser just so everyone knows....ya know..the easy stuff, and i was wondering how you would make the forward button disabled when you cant go forward.
well you dont need to have thay prebuilt thing that they give you when building a browser, and you could create your own command buttons or even better is you own pictures that look good then when you can't go foward you just say:
image.enabled = false
or
command1.enabled = true
did this help?
Keep a collection of urls. Add/Remove the URLs to the back collection/forward collection as someone moves around. If the Count for the forward collection is 0 then disable the button.
I think i understand the count thing....um...but..i'm too stupid to figure out how to put it into code. how would you put it together?
If you know how to use arrays, collections are pretty much the same thing. Though you may want to use arrays instead. Sorry, but at the moment, my mind is pretty much dead (close to bed time) I'll look into it tomorrow for some examples.
Here's a great link for the WebBrowser Control.
For what you want to do, search for CommandStateChange
http://www.vbcity.com/page.asp?f=boo...bweb&p=chapter
Here's the code I'm talking about. I believe in this example CmdNavigate(0) is the "Back" button, and CmdNavigate(2) is the "Forward" button.
VB Code:
Private Sub WebBrowser1_CommandStateChange(ByVal Command As Long, _ ByVal Enable As Boolean) If Command = 2 Then CmdNavigate(0).Enabled = Enable End If If Command = 1 Then CmdNavigate(2).Enabled = Enable End If End Sub