Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

mshtml HTMLFormElement events

18 views
Skip to first unread message

Sunny

unread,
Nov 23, 2003, 5:17:16 AM11/23/03
to
Hi all,
dev. env.: VS.Net2003/C#

I have a windows form application with web browser control. I need to
capture the onsubmit event of the forms in the document in order to get
the values and log them.

I have tried this:

1.

this.current_page = this.mydoc.Document as mshtml.HTMLDocumentClass;

if (this.current_page != null)
{
mshtml.IHTMLElementCollection _forms = this.current_page.forms;

foreach (mshtml.IHTMLFormElement _form in _forms)
{
((mshtml.HTMLFormElementEvents2_Event)_form).onsubmit +=
new mshtml.HTMLFormElementEvents2_onsubmitEventHandler
(MyDoc_onsubmit);
}
}

2.
<same, just diff. foreach>
foreach (mshtml.HTMLFormElementClass _form in this.forms)
{
_form.HTMLFormElementEvents2_Event_onsubmit +=
new mshtml.HTMLFormElementEvents2_onsubmitEventHandler
(MyDoc_onsubmit);
....

And there are 2 articles on codeproject.com, they do not work also.

And ... no success. There is no exceprions, everything passes, but after
that the form submition on the page is blocked, even the submit button
does not work.

I have tried to go around this and to use BeforeNavigate2 event of the
browser (it works) and to examine if there is postdata. But in that case
I'll loose forms which has GET method.

Please, any help will be highly appreciated.

Thanks
Sunny

MSFT

unread,
Nov 24, 2003, 3:36:29 AM11/24/03
to
Hi Sunny,

Thank you for the post. I am working on finding proper resource to assist
you on this issue and will update you soon.

Regards,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jeffrey Tan[MSFT]

unread,
Nov 25, 2003, 1:42:17 AM11/25/03
to

Hi Sunny,

I found that this post has been posted in Csharp newsgroup. I have added a
reply to you there.
Please follow up there. I will work with you.
Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

0 new messages