Search code examples
c#.netwinformserrorprovider

Disable parent window controls when there is an error in userControl


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


Solution

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