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
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.)
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.