strange behaviour of errorprovider

strange behaviour of errorprovider

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


pillesoft posted on Friday, October 17, 2008

Dear All,

i have a very simple dialog form, which contains only one textbox and save and cancel buttons.
the textbox is bounded to a csla based object's property.
and an errorprovider is also related to the bindingsource.

when the form is displaying the error icon is blinking, because i set an empty string, which is not allowed - this is normal
if i enter something into the textbox and leave it (pressed tab) (focus is at the cancel button) i have still the errorprovider icon, showing that field needs to be filled.
if i press tab again (focus is at the save button) the errorprovider icon is disappearing.

i have also set the tab order of the dialog, but the first control is the save button.

can you help me?
Ivan

JonnyBee replied on Saturday, October 18, 2008

Hi Ivan,

This is cut from the DataBindingFAQ at WindowsClient.Net
When you set “CausesValidation” to false on a Control, it will prevent automatic validation from occurring as a result of the Control taking focus.  For example, if you have a TextBox and a Button and set the Button.CausesValidation to false, tabbing from the TextBox to the Button will not cause validation to occur on the TextBox (and therefore, simple data binding will not occur on the TextBox).

Make sure that CausesValidation is true on your Save button -  that should probably fix it.

I would also recommend reading the DataGridViewFAQ and DesignerFAQ, both available on WindowsClient.Net

/jonnybee

pillesoft replied on Monday, October 20, 2008

thanks JonnyBee

these FAQs are really helpful docs

Ivan

Copyright (c) Marimer LLC