Help -- Microsoft.mshtml events stop responding...

C

celoftis

Using VS2003, VB.NET, HTML and javascript,

BACKGROUND
I have a windows app that has an ActiveX (AxInterop.SHDocVw) browser
control.
During the execution of my app, a display a HTML page that has a radio
group on it... as radio buttons are selected, I am (mostly) able to
catch the event (onclick) in my VB.NET app. As radio buttons are
clicked, javascript fires a hidden button's onclick event that is
"listened" to in the winapp:

document.getElementById("btnSubmit").fireEvent("onclick");

In my "browser_DocumentComplete" sub I set my listener up like this...
Dim objBtnSubmit As HTMLInputElement =
browser.Document.GetElementById("btnSubmit")
If objBtnSubmit Is Nothing Then
Else
AddHandler objBtnSubmit.onclick, AddressOf
myBtnSubmit
End If

Then in sub myBtnSubmit, I run some code to do whatever...

PROBLEM
At some point the windows app stops handling the HTML events that are
being fired (myBtnSubmit does not get executed). After the win app
stops responding to HTML events, the javascript in the HTML page
continues to run correctly -- so I'm now weary of MSHTML's ability to
handle the events that are being raised. The handler seems to quit
working if I fire the onclick event quickly and repeatedly.

Is this a known issue with MSHTML handling HTML events? Is there
something that could be breaking this call back?

Any thoughts on the cause of this problem and/or viable solutions
would be appreciated.

Thanks for your attention to this... celoftis
 
C

celoftis

Figured this one out... maybe this will help someone else.
Turns out it was a simple scope problem... I was declaring references
to MSHTML elements in my ...DocumentComplete sub but then trying to
reference them in other sub's - thus the references were our of scope.
I believe that I was having some success because I was using the
references before the GarbageCollector had cleaned up the reference
pointers...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top