473,657 Members | 2,594 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 "BeforeNavigate 2" event handler
fires as expected, unitl I also add a handler to the "onclick"
event that is part of the mshtml.HTMLDocu mentEvent2 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.axWebBrows er1.BeforeNavig ate2 += new
AxSHDocVw.DWebB rowserEvents2_B eforeNavigate2E ventHandler
(this.axWebBrow ser1_BeforeNavi gate2);

//This goes on the Download complete handler:

mshtml.HTMLDocu ment doc = (mshtml.HTMLDoc ument)axWebBrow ser1.Document;
mshtml.HTMLDocu mentEvents2_Eve nt iEvent =
(mshtml.HTMLDoc umentEvents2_Ev ent) doc;
iEvent.onclick += new
mshtml.HTMLDocu mentEvents2_onc lickEventHandle r(iEvent_onclic k);

Nov 16 '05 #1
2 4941
Mitch,

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

You have to implement IDocHostUIHandl er and IHTMLEditDesign er to handle the
events. Search in MSDN for this.

Shak.
"Mitch" <xx***@avantium .com> wrote in message
news:#C******** ******@TK2MSFTN GP12.phx.gbl...
I ahve a windowsform app with an embedded web browser. I let VS create a
wrapper called AxWebBrowser. The "BeforeNavigate 2" event handler
fires as expected, unitl I also add a handler to the "onclick"
event that is part of the mshtml.HTMLDocu mentEvent2 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.axWebBrows er1.BeforeNavig ate2 += new
AxSHDocVw.DWebB rowserEvents2_B eforeNavigate2E ventHandler
(this.axWebBrow ser1_BeforeNavi gate2);

//This goes on the Download complete handler:

mshtml.HTMLDocu ment doc = (mshtml.HTMLDoc ument)axWebBrow ser1.Document;
mshtml.HTMLDocu mentEvents2_Eve nt iEvent =
(mshtml.HTMLDoc umentEvents2_Ev ent) doc;
iEvent.onclick += new
mshtml.HTMLDocu mentEvents2_onc lickEventHandle r(iEvent_onclic k);

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 IDocHostUIHandl er
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**@fakedomai n.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Mitch,

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

You have to implement IDocHostUIHandl er and IHTMLEditDesign er to handle the events. Search in MSDN for this.

Shak.
"Mitch" <xx***@avantium .com> wrote in message
news:#C******** ******@TK2MSFTN GP12.phx.gbl...
I ahve a windowsform app with an embedded web browser. I let VS create a wrapper called AxWebBrowser. The "BeforeNavigate 2" event handler
fires as expected, unitl I also add a handler to the "onclick"
event that is part of the mshtml.HTMLDocu mentEvent2 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.axWebBrows er1.BeforeNavig ate2 += new
AxSHDocVw.DWebB rowserEvents2_B eforeNavigate2E ventHandler
(this.axWebBrow ser1_BeforeNavi gate2);

//This goes on the Download complete handler:

mshtml.HTMLDocu ment doc = (mshtml.HTMLDoc ument)axWebBrow ser1.Document; mshtml.HTMLDocu mentEvents2_Eve nt iEvent =
(mshtml.HTMLDoc umentEvents2_Ev ent) doc;
iEvent.onclick += new
mshtml.HTMLDocu mentEvents2_onc lickEventHandle r(iEvent_onclic k);


Nov 16 '05 #3

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

Similar topics

2
5815
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 webbrowser object. The URL is set beforehand in the browser object. I'm using Webbrowser1.URL.ToString to check it. However, I get the following error when I try this: "A first chance exception of type 'System.NullReferenceException' occurred in (my...
9
3173
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 the html code and tables programmatically in a string, and I give the string to the property DocumentText of the WebBrowser, and I insert in this code some Hyperlinks by wich I could react, launching an specific action) The properties...
1
6290
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 webpage with username and password. The login is working since I can look at the files (XML-files) by navigating to them(see the XML in them), which should be possible if the user is not logged in. So figure the WebBrowser object now have a...
1
41016
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 not using it to do any actual web browsing. I use 'webBrowser1.DocumentText = myText' to load an HTML string into the control. But I can't clear that text when I want to load a new string into the control.
1
3692
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 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....
2
4290
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, so if I need to elaborate on something please ask for it. We have a UserControl with a WebBrowser on it. This UserControl is instantiated a few times during the program run, depending on user interaction. The WebBrowser then navigates to a local...
1
927
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 current page I have spent hours and hours and hours on this and have exhausted every possible solution and still have not found a solution that works for all cases. Some tricks I have tried:
0
1908
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 based on the Uri that is passed in the WebBrowserNavigatingEventArgs.Url property. If the page is requesting an external URL, I would like to open the page in a new browser window. When requesting an external page, the URL is of the form:...
17
7952
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 while, the application is using more than 100 or 150 Mb in RAM, and if I let it continue, it can leave the system without memory. I've been watching in some pages that other people has the same problem with this control when keep navigating for a...
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
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
8730
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...
0
7321
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.