Form TextBox validation of type System.Windows.Forms.TextBox, possible?

Topics: Validation Application Block
Aug 4, 2007 at 6:05 PM
Hello everyone,

In the Enterprise Library Configuration I have a validation Application Block, in there I created:

1. New Type System.Windows.Forms.TextBox
2. New RuleSetA
3. Under RuleSetA: New Choose Members, Text
4. Under Text, New String Length Validator

Then in the Form I have a validationProvider and it's SourceTypeName=System.Windows.Forms.TextBox

This fails with the error: The source type does not represent a valid type for validation provider.

Is this possible or do I always need to Create Business Entities to be able to validate Windows Form Controls? If it is possible, can you point me in the right direction for this to work?

Thanks
Aug 6, 2007 at 2:57 AM
What you're doing should work - I think the issue is that the SourceTypeName needs to be assembly-qualified, ie
System.Windows.Forms.TextBox, System.Windows.Forms

Tom
Aug 6, 2007 at 12:07 PM
Tom,

I tried your suggestion but I still get the same error.

Thanks


tomhollander wrote:
What you're doing should work - I think the issue is that the SourceTypeName needs to be assembly-qualified, ie
System.Windows.Forms.TextBox, System.Windows.Forms

Tom

Aug 6, 2007 at 11:32 PM
Actually since the System.Windows.Forms assembly is in the GAC, the type reference needs to be assembly qualified, i.e.:
System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
I just tested this and it works.

Tom
Aug 13, 2007 at 12:35 PM
Tom,

Sorry for the big delay, I took a mini vacation....Anyway, it works fine using the full assembly qualified as you specified above.

Thanks a lot in advance


tomhollander wrote:
Actually since the System.Windows.Forms assembly is in the GAC, the type reference needs to be assembly qualified, i.e.:
System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
I just tested this and it works.

Tom