当 userControl 出现错误时禁用父窗口控件

发布于 2025-01-03 04:47:13 字数 177 浏览 0 评论 0原文

在 Windows 窗体中,我有一些控件和一个 UserControl。我在 UserControl 中有一个 ErrorProvider 。如果用户控件中存在错误,我想停止编辑表单中的所有控件。有什么办法可以做到这一点吗?

我正在使用 errorProvider.BindToCustomDataAndErrors(..)

In a Windows form I've some controls and a UserControl. I've a ErrorProvider in the UserControl. I want to stop editing all the controls in the Form if there is an error in the userControl. Is there any way to do that?

I am using errorProvider.BindToCustomDataAndErrors(..)

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

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

发布评论

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

评论(1

堇色安年 2025-01-10 04:47:13

据我所知,Windows Forms 中没有任何内置方法可以执行类似的操作。我确实相信你应该自己实施它。

您可以创建一个类似 ErrorRecieved 的事件(例如),并在其处理程序中禁用控件。

编辑

这里还有一个类似SO问题的链接。

There is no any built-in way in Windows Forms that I'm aware of, to do something like that. I do believe you should implement it by yourself.

You can create an event like ErrorRecieved (say), and Disable controls in its handler.

EDIT

Here also a link to similar SO question.

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