F
Fla
Hy!
I've developed a small browser for navigate into an HTML manual inside
a form, but I found the following problem when I browse through links
in the same HTML doc: I can't use the GoForward button 'cause
CanGoForward boolean value switches from true to false when I go back
in the link history (i.e. I go to the previous page link)...
but it shouldn't go false 'cause when I browse back there's at least
one page accesible in forward....
I post the following VB.NET code:
Public Class Form_Help2
#Region "Form"
Private Sub Form_Help2_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Me.WebBrowser1.Url = New Uri(Application.StartupPath & "\manual.html"
& "#Figura_8")
Me.WebBrowser1.AllowNavigation = True
Me.browserBackButton.Enabled = False
Me.browserForwardButton.Enabled = False
End Sub
Private Sub Form_Help2_PreviewKeyDown(ByVal sender As Object, ByVal e
As System.Windows.Forms.PreviewKeyDownEventArgs) Handles
Me.PreviewKeyDown,
WebBrowser1.PreviewKeyDown, simpleBrowserToolStrip.PreviewKeyDown,
ToolStripContainer1.PreviewKeyDown
Select Case e.KeyCode
Case Keys.F12
Me.Close
case Keys.F4
if(Keys.Modifiers = Keys.Shift)
Me.Close
End If
End Select
End Sub
#End Region
#Region "WebBrowser"
Private Sub WebBrowser1_CanGoBackChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles WebBrowser1.CanGoBackChanged
Me.browserBackButton.Enabled = Me.WebBrowser1.CanGoBack
End Sub
Private Sub WebBrowser1_CanGoForwardChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles WebBrowser1.CanGoForwardChanged
Me.browserForwardButton.Enabled = Me.WebBrowser1.CanGoForward
End Sub
Private Sub WebBrowser1_Navigated(ByVal sender As Object, ByVal e As
System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles
WebBrowser1.Navigated
Me.browserAddressTextBox.Text = Me.WebBrowser1.Url.ToString
Me.ToolStripStatusLabel1.Text = Me.WebBrowser1.Url.ToString
Me.ToolStripProgressBar1.Value = Me.ToolStripProgressBar1.Maximum
End Sub
Private Sub WebBrowser1_Navigating(ByVal sender As Object, ByVal e As
System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles
WebBrowser1.Navigating
Me.ToolStripStatusLabel1.Text = "Navigating to " &
Me.WebBrowser1.Url.ToString & " ..."
Me.ToolStripProgressBar1.Value += 1
End Sub
#End Region
Private Sub browserBackButton_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles browserBackButton.Click
Me.WebBrowser1.GoBack
End Sub
Private Sub browserForwardButton_Click(ByVal sender As Object, ByVal e
As System.EventArgs) Handles browserForwardButton.Click
Me.WebBrowser1.GoForward
End Sub
Private Sub browserRefreshButton_Click(ByVal sender As Object, ByVal e
As System.EventArgs) Handles browserRefreshButton.Click
Me.WebBrowser1.Refresh
End Sub
Private Sub browserGoButton_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles browserGoButton.Click
Me.WebBrowser1.Navigate(Me.browserAddressTextBox.Text)
End Sub
End Class
The HTML code for internal link is like the following one:
....
<a href="#Figura_8">figura 8</a>.
<br /><br />
<div style="text-align: center;">
<a name="Figura_8"></a>
<img style="width: 640px; height: 487px;" alt="Figura 8 non
visualizzata" title="Figura 8: etichetta" src="Images/
Acq_TollLab.png" />
<br />Figura 8: etichetta<br /><div style="text-align: left;"><br />
....
What am I doing wrong?
Any suggestion?
I've developed a small browser for navigate into an HTML manual inside
a form, but I found the following problem when I browse through links
in the same HTML doc: I can't use the GoForward button 'cause
CanGoForward boolean value switches from true to false when I go back
in the link history (i.e. I go to the previous page link)...
but it shouldn't go false 'cause when I browse back there's at least
one page accesible in forward....
I post the following VB.NET code:
Public Class Form_Help2
#Region "Form"
Private Sub Form_Help2_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Me.WebBrowser1.Url = New Uri(Application.StartupPath & "\manual.html"
& "#Figura_8")
Me.WebBrowser1.AllowNavigation = True
Me.browserBackButton.Enabled = False
Me.browserForwardButton.Enabled = False
End Sub
Private Sub Form_Help2_PreviewKeyDown(ByVal sender As Object, ByVal e
As System.Windows.Forms.PreviewKeyDownEventArgs) Handles
Me.PreviewKeyDown,
WebBrowser1.PreviewKeyDown, simpleBrowserToolStrip.PreviewKeyDown,
ToolStripContainer1.PreviewKeyDown
Select Case e.KeyCode
Case Keys.F12
Me.Close
case Keys.F4
if(Keys.Modifiers = Keys.Shift)
Me.Close
End If
End Select
End Sub
#End Region
#Region "WebBrowser"
Private Sub WebBrowser1_CanGoBackChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles WebBrowser1.CanGoBackChanged
Me.browserBackButton.Enabled = Me.WebBrowser1.CanGoBack
End Sub
Private Sub WebBrowser1_CanGoForwardChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles WebBrowser1.CanGoForwardChanged
Me.browserForwardButton.Enabled = Me.WebBrowser1.CanGoForward
End Sub
Private Sub WebBrowser1_Navigated(ByVal sender As Object, ByVal e As
System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles
WebBrowser1.Navigated
Me.browserAddressTextBox.Text = Me.WebBrowser1.Url.ToString
Me.ToolStripStatusLabel1.Text = Me.WebBrowser1.Url.ToString
Me.ToolStripProgressBar1.Value = Me.ToolStripProgressBar1.Maximum
End Sub
Private Sub WebBrowser1_Navigating(ByVal sender As Object, ByVal e As
System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles
WebBrowser1.Navigating
Me.ToolStripStatusLabel1.Text = "Navigating to " &
Me.WebBrowser1.Url.ToString & " ..."
Me.ToolStripProgressBar1.Value += 1
End Sub
#End Region
Private Sub browserBackButton_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles browserBackButton.Click
Me.WebBrowser1.GoBack
End Sub
Private Sub browserForwardButton_Click(ByVal sender As Object, ByVal e
As System.EventArgs) Handles browserForwardButton.Click
Me.WebBrowser1.GoForward
End Sub
Private Sub browserRefreshButton_Click(ByVal sender As Object, ByVal e
As System.EventArgs) Handles browserRefreshButton.Click
Me.WebBrowser1.Refresh
End Sub
Private Sub browserGoButton_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles browserGoButton.Click
Me.WebBrowser1.Navigate(Me.browserAddressTextBox.Text)
End Sub
End Class
The HTML code for internal link is like the following one:
....
<a href="#Figura_8">figura 8</a>.
<br /><br />
<div style="text-align: center;">
<a name="Figura_8"></a>
<img style="width: 640px; height: 487px;" alt="Figura 8 non
visualizzata" title="Figura 8: etichetta" src="Images/
Acq_TollLab.png" />
<br />Figura 8: etichetta<br /><div style="text-align: left;"><br />
....
What am I doing wrong?
Any suggestion?