在webbrowser控件中提交表单,在winform中获取结果。如何?

发布于 2024-12-12 17:35:50 字数 127 浏览 2 评论 0原文

我有一个嵌入了网页浏览器控件的 winform 应用程序。 我在 webbrowser 控件中加载一个 html,在 html 中填写表单,然后单击提交 问题是我需要能够将提交的数据捕获为 winform 应用程序中的变量。这可能吗?请帮我

I have a winform application that i embeded a webrowser control.
I load an html in the webbrowser control, fill the form in the html and click submit
the problem is that i need to be able to capture the submitted data as variables in the winform app. id this possible? please help me

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷血 2024-12-19 17:35:50

您可以附加到按钮单击事件代码:

var theButton = webbrowser1.Document.GetElementById("loginbutton")
theButton.Click += (sender, args) => { ... };

在处理程序中,您可以从以下位置获取表单字段:

webbrowser1.Document

它允许您在提交之前实际捕获填写的表单。当然,所有这些事情都必须在 DocumentCompleted 事件中完成。

希望有帮助。

you can attach to button click event code:

var theButton = webbrowser1.Document.GetElementById("loginbutton")
theButton.Click += (sender, args) => { ... };

and in handler you can get form fields from:

webbrowser1.Document

It allows you to capture filled form actually before it's submited. Ofcource all this stuff must be done in DocumentCompleted Event.

Hope it helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文