473,503 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebBrowser stops navigating - Why?

I ahve a windowsform app with an embedded web browser. I let VS create a
wrapper called AxWebBrowser. The "BeforeNavigate2" event handler
fires as expected, unitl I also add a handler to the "onclick"
event that is part of the mshtml.HTMLDocumentEvent2 object. In addition
when I add the "onclick" event handler, the browser looses all
ability to navigate. i.e. clicking a link does nothing, no events
raised, no navigating to the link url.

If tried different return values in the "onclick" event handler,
but the results are always the same. I've seen older posts with
this same problem, but no one seems to have figured it out.

Any ideas? Thanks.

Mitch

Here's the code where I wire up the event handlers:

this.axWebBrowser1.BeforeNavigate2 += new
AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2EventH andler
(this.axWebBrowser1_BeforeNavigate2);

//This goes on the Download complete handler:

mshtml.HTMLDocument doc = (mshtml.HTMLDocument)axWebBrowser1.Document;
mshtml.HTMLDocumentEvents2_Event iEvent =
(mshtml.HTMLDocumentEvents2_Event) doc;
iEvent.onclick += new
mshtml.HTMLDocumentEvents2_onclickEventHandler(iEv ent_onclick);

Nov 16 '05 #1
2 4928
Mitch,

If you add onclick event handler, the browser will go for toss for sure.

You have to implement IDocHostUIHandler and IHTMLEditDesigner to handle the
events. Search in MSDN for this.

Shak.
"Mitch" <xx***@avantium.com> wrote in message
news:#C**************@TK2MSFTNGP12.phx.gbl...
I ahve a windowsform app with an embedded web browser. I let VS create a
wrapper called AxWebBrowser. The "BeforeNavigate2" event handler
fires as expected, unitl I also add a handler to the "onclick"
event that is part of the mshtml.HTMLDocumentEvent2 object. In addition
when I add the "onclick" event handler, the browser looses all
ability to navigate. i.e. clicking a link does nothing, no events
raised, no navigating to the link url.

If tried different return values in the "onclick" event handler,
but the results are always the same. I've seen older posts with
this same problem, but no one seems to have figured it out.

Any ideas? Thanks.

Mitch

Here's the code where I wire up the event handlers:

this.axWebBrowser1.BeforeNavigate2 += new
AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2EventH andler
(this.axWebBrowser1_BeforeNavigate2);

//This goes on the Download complete handler:

mshtml.HTMLDocument doc = (mshtml.HTMLDocument)axWebBrowser1.Document;
mshtml.HTMLDocumentEvents2_Event iEvent =
(mshtml.HTMLDocumentEvents2_Event) doc;
iEvent.onclick += new
mshtml.HTMLDocumentEvents2_onclickEventHandler(iEv ent_onclick);

Nov 16 '05 #2
I saw that, but it seems like I already have access to the events I need.
It's just that one event kills another. Also the IDocHostUIHandler
has 17 methods and I can't find a good example of what each method should
do.

Is it a bug that one event handler kills the other? or is there some
explanation?

Mitch
"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Mitch,

If you add onclick event handler, the browser will go for toss for sure.

You have to implement IDocHostUIHandler and IHTMLEditDesigner to handle the events. Search in MSDN for this.

Shak.
"Mitch" <xx***@avantium.com> wrote in message
news:#C**************@TK2MSFTNGP12.phx.gbl...
I ahve a windowsform app with an embedded web browser. I let VS create a wrapper called AxWebBrowser. The "BeforeNavigate2" event handler
fires as expected, unitl I also add a handler to the "onclick"
event that is part of the mshtml.HTMLDocumentEvent2 object. In addition
when I add the "onclick" event handler, the browser looses all
ability to navigate. i.e. clicking a link does nothing, no events
raised, no navigating to the link url.

If tried different return values in the "onclick" event handler,
but the results are always the same. I've seen older posts with
this same problem, but no one seems to have figured it out.

Any ideas? Thanks.

Mitch

Here's the code where I wire up the event handlers:

this.axWebBrowser1.BeforeNavigate2 += new
AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2EventH andler
(this.axWebBrowser1_BeforeNavigate2);

//This goes on the Download complete handler:

mshtml.HTMLDocument doc = (mshtml.HTMLDocument)axWebBrowser1.Document; mshtml.HTMLDocumentEvents2_Event iEvent =
(mshtml.HTMLDocumentEvents2_Event) doc;
iEvent.onclick += new
mshtml.HTMLDocumentEvents2_onclickEventHandler(iEv ent_onclick);


Nov 16 '05 #3

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

Similar topics

2
5810
by: Randall Arnold | last post by:
I'm creating a VB 2005 Express app that hosts the webbrowser control. Everything works well except one area: the Navigating event. In that event, I need to evaluate the URL property of the...
9
3142
by: philip | last post by:
Is it possible, on a WebBrowser control, to intercept a HyperLink and react programmatically to this click ? That's my first question. In fact, I use the Webbrowser as a sort of report (I write...
1
6274
by: Eggy | last post by:
Hi. I have an application that should download files from internet. The problem is the protocol is HTTPS. So I have a System.Windows.Forms.WebBrowser which allows the user to log in to the HTTPS...
1
40976
by: David Veeneman | last post by:
In .NET 2.0, how do I clear the contents of a web browser control? I'm using a WebBrowser control in a Windows Form app to display strings genrated by my application and formatted as HTML--I'm...
1
3682
by: Fla | last post by:
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...
2
4275
by: Jeroen | last post by:
We are experiencing a tuff-to-debug problem ever since we introduced a WebBrowser control into our failry large application. I'm not sure if the problem description below contains enough details,...
1
919
Logan1337
by: Logan1337 | last post by:
Ok folks, I have a challenge for you. It's simply stated, but not so simply done: Show me how to tell when a WebBrowser control: a) starts to load a new page, and b) finishes loading the...
0
1898
by: in10se | last post by:
I have a .NET 2.0 application that uses the WebBrowser control. Because all of my pages are generated dynamically, I am catching the Navigating event, cancelling it, and performing my own operations...
17
7930
by: Cesar | last post by:
Hello people. I'm having a Winform app that contains a webbrowser control that keeps navigating from one page to another permanentrly to make some tests. The problem I'm having is that after a...
0
7074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7273
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,...
0
5572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5000
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...
0
4667
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...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1501
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 ...
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.