VB .NET Web Browser Trouble

TechieFreak05

New member
Joined
Jul 19, 2005
Messages
1
Programming Experience
Beginner
I am having trouble with my web browser I am making in VB .NET. The "Back" and "forward" buttons are the problem...they work, its just that when a user tries to go Forward or Back, when there is nowhere to go Back or Forward to, A error dialog pops up, and you press Continue and its fine, but I want it so If there are no pages Back, disable Back button, and if there are pages back, enable back button, and vice-versa for Forward. Can anyone please help?

Oh, and does anyone know how to set the titlebar of the window to the title of the web site, Like *VB .NET Forums - Internet Explorer.*
I can only get it to show my browser name, because thats what i type.
 
Last edited:
I'm assuming you're using the AxWebBrowser COM control in the creation of your browser.
To set the Back and Forward enabled status, use the CommandStateChange event of the AxWebBrowser. To set the titlebar to the title of the website, use the TitleChange event. In this example my browser control is named wbBrowser.
VB.NET:
Private Enum cscec 'CommandStateChangeEventCommand
    Back = 2
    Forward = 1
End Enum

Private Sub wbBrowser_CommandStateChange(ByVal sender As Object, _
  ByVal e As AxSHDocVw.DWebBrowserEvents2_CommandStateChangeEvent) _
  Handles wbBrowser.CommandStateChange
    Select Case e.command
        Case cscec.Back
            Me.cmdBack.Enabled = e.enable
        Case cscec.Forward
            Me.cmdForward.Enabled = e.enable
    End Select
End Sub

Private Sub wbBrowser_TitleChange(ByVal sender As Object, _
  ByVal e As AxSHDocVw.DWebBrowserEvents2_TitleChangeEvent) _
  Handles wbBrowser.TitleChange
    Me.Text = e.text & " - myBrowser"
End Sub
 
Back
Top