473,657 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebBrowser and CanGoForward

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.EventArg s) Handles Me.Load

Me.WebBrowser1. Url = New Uri(Application .StartupPath & "\manual.ht ml"
& "#Figura_8" )
Me.WebBrowser1. AllowNavigation = True
Me.browserBackB utton.Enabled = False
Me.browserForwa rdButton.Enable d = False

End Sub

Private Sub Form_Help2_Prev iewKeyDown(ByVa l sender As Object, ByVal e
As System.Windows. Forms.PreviewKe yDownEventArgs) Handles
Me.PreviewKeyDo wn,
WebBrowser1.Pre viewKeyDown, simpleBrowserTo olStrip.Preview KeyDown,
ToolStripContai ner1.PreviewKey Down

Select Case e.KeyCode
Case Keys.F12
Me.Close
case Keys.F4
if(Keys.Modifie rs = Keys.Shift)
Me.Close
End If
End Select

End Sub

#End Region

#Region "WebBrowser "

Private Sub WebBrowser1_Can GoBackChanged(B yVal sender As Object, ByVal
e As System.EventArg s) Handles WebBrowser1.Can GoBackChanged

Me.browserBackB utton.Enabled = Me.WebBrowser1. CanGoBack
End Sub
Private Sub WebBrowser1_Can GoForwardChange d(ByVal sender As Object,
ByVal e As System.EventArg s) Handles WebBrowser1.Can GoForwardChange d
Me.browserForwa rdButton.Enable d = Me.WebBrowser1. CanGoForward

End Sub

Private Sub WebBrowser1_Nav igated(ByVal sender As Object, ByVal e As
System.Windows. Forms.WebBrowse rNavigatedEvent Args) Handles
WebBrowser1.Nav igated

Me.browserAddre ssTextBox.Text = Me.WebBrowser1. Url.ToString
Me.ToolStripSta tusLabel1.Text = Me.WebBrowser1. Url.ToString
Me.ToolStripPro gressBar1.Value = Me.ToolStripPro gressBar1.Maxim um

End Sub

Private Sub WebBrowser1_Nav igating(ByVal sender As Object, ByVal e As
System.Windows. Forms.WebBrowse rNavigatingEven tArgs) Handles
WebBrowser1.Nav igating

Me.ToolStripSta tusLabel1.Text = "Navigating to " &
Me.WebBrowser1. Url.ToString & " ..."
Me.ToolStripPro gressBar1.Value += 1

End Sub

#End Region

Private Sub browserBackButt on_Click(ByVal sender As Object, ByVal e As
System.EventArg s) Handles browserBackButt on.Click

Me.WebBrowser1. GoBack

End Sub

Private Sub browserForwardB utton_Click(ByV al sender As Object, ByVal e
As System.EventArg s) Handles browserForwardB utton.Click

Me.WebBrowser1. GoForward

End Sub

Private Sub browserRefreshB utton_Click(ByV al sender As Object, ByVal e
As System.EventArg s) Handles browserRefreshB utton.Click

Me.WebBrowser1. Refresh

End Sub

Private Sub browserGoButton _Click(ByVal sender As Object, ByVal e As
System.EventArg s) Handles browserGoButton .Click

Me.WebBrowser1. Navigate(Me.bro wserAddressText Box.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?

Feb 1 '07 #1
1 3692
Fla,

Mostly it is easier to make a simple program for yourself, that is only
doing the most needed things.

People active in this newgroup are always want to help, the problem has than
however to be short described.

Cor

"Fla" <fl********@tis cali.itschreef in bericht
news:11******** **************@ a75g2000cwd.goo glegroups.com.. .
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.EventArg s) Handles Me.Load

Me.WebBrowser1. Url = New Uri(Application .StartupPath & "\manual.ht ml"
& "#Figura_8" )
Me.WebBrowser1. AllowNavigation = True
Me.browserBackB utton.Enabled = False
Me.browserForwa rdButton.Enable d = False

End Sub

Private Sub Form_Help2_Prev iewKeyDown(ByVa l sender As Object, ByVal e
As System.Windows. Forms.PreviewKe yDownEventArgs) Handles
Me.PreviewKeyDo wn,
WebBrowser1.Pre viewKeyDown, simpleBrowserTo olStrip.Preview KeyDown,
ToolStripContai ner1.PreviewKey Down

Select Case e.KeyCode
Case Keys.F12
Me.Close
case Keys.F4
if(Keys.Modifie rs = Keys.Shift)
Me.Close
End If
End Select

End Sub

#End Region

#Region "WebBrowser "

Private Sub WebBrowser1_Can GoBackChanged(B yVal sender As Object, ByVal
e As System.EventArg s) Handles WebBrowser1.Can GoBackChanged

Me.browserBackB utton.Enabled = Me.WebBrowser1. CanGoBack
End Sub
Private Sub WebBrowser1_Can GoForwardChange d(ByVal sender As Object,
ByVal e As System.EventArg s) Handles WebBrowser1.Can GoForwardChange d
Me.browserForwa rdButton.Enable d = Me.WebBrowser1. CanGoForward

End Sub

Private Sub WebBrowser1_Nav igated(ByVal sender As Object, ByVal e As
System.Windows. Forms.WebBrowse rNavigatedEvent Args) Handles
WebBrowser1.Nav igated

Me.browserAddre ssTextBox.Text = Me.WebBrowser1. Url.ToString
Me.ToolStripSta tusLabel1.Text = Me.WebBrowser1. Url.ToString
Me.ToolStripPro gressBar1.Value = Me.ToolStripPro gressBar1.Maxim um

End Sub

Private Sub WebBrowser1_Nav igating(ByVal sender As Object, ByVal e As
System.Windows. Forms.WebBrowse rNavigatingEven tArgs) Handles
WebBrowser1.Nav igating

Me.ToolStripSta tusLabel1.Text = "Navigating to " &
Me.WebBrowser1. Url.ToString & " ..."
Me.ToolStripPro gressBar1.Value += 1

End Sub

#End Region

Private Sub browserBackButt on_Click(ByVal sender As Object, ByVal e As
System.EventArg s) Handles browserBackButt on.Click

Me.WebBrowser1. GoBack

End Sub

Private Sub browserForwardB utton_Click(ByV al sender As Object, ByVal e
As System.EventArg s) Handles browserForwardB utton.Click

Me.WebBrowser1. GoForward

End Sub

Private Sub browserRefreshB utton_Click(ByV al sender As Object, ByVal e
As System.EventArg s) Handles browserRefreshB utton.Click

Me.WebBrowser1. Refresh

End Sub

Private Sub browserGoButton _Click(ByVal sender As Object, ByVal e As
System.EventArg s) Handles browserGoButton .Click

Me.WebBrowser1. Navigate(Me.bro wserAddressText Box.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?

Feb 1 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3459
by: Jim Hubbard | last post by:
How would I implement the IDispatch interface to handle the following in VB.Net <BEGIN> Controlling Download and Execution The WebBrowser Control gives you control over what it downloads, displays, and executes. To gain this control, you need to implement your host's IDispatch so it handles DISPID_AMBIENT_DLCONTROL. When the WebBrowser Control is instantiated, it will call your IDispatch::Invoke with this ID. Set pvarResult to a...
5
3111
by: SPE - Stani's Python Editor | last post by:
Hi, During optimizing SPE for Ubuntu, I found something strange. I have Ubuntu 5.10 "The Breezy Badger" and unfortunately this code is not working: >>> import webbrowser >>> webbrowser.open("http://www.python.org") It does not throw an exception, but is not able to launch a browser.
12
6357
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but of course it's thrown up a whole host of new issues... I'm generating a multi page printable document in HTML from my app, and displaying it in a WebBrowser control. I've looked into using some CSS
8
3400
by: Prosperz | last post by:
Hi, I would like to make thumbnails of web page by capture content of a WebBrowser. By example, capture http://www.google.com. I used WebBrowser control with Framework 2.0. I try this : *************************************************
8
4628
by: Dustan | last post by:
At http://docs.python.org/whatsnew/modules.html on the webbrowser module, it says "A number of additional browsers were added to the supported list such as Firefox, Opera, Konqueror, and elinks." I just installed python 2.5, looking forward to being able to control firefox without having to make it my default browser, but... I don't seem to have that functionality. In IDLE: {'windows-default': }
11
2817
by: Anil Gupte | last post by:
....and how do I insert one into my form? I used in VB 6.0 last, but cannot figure out where it is in .Net Thanx, -- Anil Gupte www.keeninc.net www.icinema.com
18
6844
by: Zytan | last post by:
I have multiple threads writing to WebBrowser (using a function that checks InvokedRequired, and if so, invokes itself on the WebBrowser thread) and they are getting deadlocked. They only deadlock when I use lock { } around the call to WebBrowser.Write to ensure thread safety! Does any one have experience with such a thing? Zytan
11
2207
by: kimiraikkonen | last post by:
Hi there, I needed to use MouseOver event on Webbrowser which is NOT provided by webbrowser control natively(what a disappointment), so i decided to go with another route to simulate this like: //////////////////////////////////////////////// Public Sub DisplayHyperlinks(ByVal sender As Object, ByVal e As System.Windows.Forms.HtmlElementEventArgs)
3
9434
by: TedTrippin | last post by:
Hi, Background - I've create a windows application in VS and added a WebBrowser component and all works well. I'm now trying to do this programmatically. My application now listens on a socket and when it receives a request it creates a new Form and adds a new WebBrowser. The problem - All works well without the WebBrowser, the form is visible, but when I do "Controls.Add(webBrowser)" I see nothing, not even something in the windows...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.