Duplicated ErrorProvider Error Description

Duplicated ErrorProvider Error Description

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


tsouki posted on Monday, July 03, 2006

Hi,

I have a root business object with no childs, derived from business base which is used as binding source for various properties of a win form.

Everything it's OK, except for error provider which shows the error messages duplicated. For example instead of

"Net Price is required since product is marked 'For Sale'."

prints

"Net Price is required since product is marked 'For Sale'.
Net Price is required since product is marked 'For Sale'."

This strange behaviour happens only when validation events fire. When I hit Save, the error messages are normal. I've already checked the rule methods and the properties. They seem OK.

Any ideas?

ajj3085 replied on Monday, July 03, 2006

Do you have more than one error provider on your form?

Are you sure the rules aren't being run twice?

tsouki replied on Monday, July 03, 2006

No. I have one error provider, for some reason the description string is double. When you move the mouse pointer over the red dot instead of reading for example "Code required" you read
"Code required
Code required".

The e.description is for sure correctly setted to "Code required" and not "Code required" & vbcrlf & "Code required" and I'm not drunk to see things double. :-)

I have only one ErrorProvider on my form.

I know it sounds crazy.

 

tsouki replied on Tuesday, July 04, 2006

My friends, I figured out what was wrong.

On the various text boxes, except for the text property, I had also bind the tag property of the control to a corresponding object property. Thus, although the BrokenRulesCollection was containing only once the error, the error provider was displaying the error as many times as the number of the control binded properties.

Thanks, for any help.

ajj3085 replied on Wednesday, July 05, 2006

Glad you figured it out (and posted the solution back).  It makes sense I suppose, since the property bound to the tag could be different than the one bound to to Text.

Copyright (c) Marimer LLC