当 userControl 出现错误时禁用父窗口控件
在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,
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.