S
Sunny
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
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