Databinding in WinForms with ErrorProvider in .Net 2.0

Databinding in WinForms with ErrorProvider in .Net 2.0

Old forum URL: forums.lhotka.net/forums/t/2316.aspx


Aliator posted on Saturday, February 10, 2007

Hi, I have an issue with numeric TextBoxes behaviour.

If I put a letter in a TextBox supposed to handle Decimal type, I get the warning icon, telling me that value is not good (Input string was not in correct format), but, I can't focus anywhere in the app until the value of the TextBox is numeric .

It's a weird behaviour, because broken rules aka text length don't do these (block the UI), and this gives an inconsistent behaviour to the app...

Is it possible to disable it ?

BTW, I'm developping the app in french, and the CultureInfo is set to fr-FR, but the error messages are shown in English. I have the Csla.resources.dll file in bin\fr directory...

What am I missing ?

Thank you.

Brian Criswell replied on Sunday, February 11, 2007

The reason is that your data binding is throwing a conversion exception.  This is caught and displayed.  Because it is an exception, you are not allowed to leave until you fix it.  Regular business rules allow you to  move on because they do not throw exceptions.

Aliator replied on Sunday, February 11, 2007

Ok, so I'll use an extended TextBox to allow numbers.

Thank you

Copyright (c) Marimer LLC