MessageTemplateResourceType (VB Won't work)

Topics: Validation Application Block
Aug 1, 2007 at 9:40 AM
Hi All

I just placed the following code under my VB project "Entites" Folder and the Resources1.resx in the entities folder also.

<StringLengthValidator(3, 10, MessageTemplateResourceName:="InvalidStringLengthMessage",
MessageTemplateResourceType:=GetType(Entities.Resource1), RuleSet:="Primary")> _

However, it won't work since it just show the blank for the error message once it trigger the error.

The error message couldn't show correctly.

What happen? Is this a bug or something I mis-config?
Aug 1, 2007 at 12:25 PM
Hi,

Resource types do work in VB.NET. However, because of the way resources are accessed the full name of the resources type must match with the name of the resources file. It seems this is not the default for VB.NET projects. You'll need to change the value for the namespace for the custom tool property on the resource file in your solution; leaving it empty should do the trick.

Regards,
Fernando
Aug 3, 2007 at 2:07 AM
Hi Fernando

Thanks, it works now.

However, if I want the resoruces share with multi-project? Could I implement in this way? Thanks.

Regards
Alex
Aug 3, 2007 at 12:51 PM
Hi,

I don't really understand what you mean by this.

Regards,
Fernando
Aug 5, 2007 at 4:18 AM
I would like to setup two project in one solution.

One project contains the resources file to centralize the resources and the other is main application. Could I do it in this way?

Regards
Alex
Aug 6, 2007 at 2:23 PM
Hi,

So your problem really is that the resource types are not public so you cannot reference them from outside the project defining them? You can work around this by removing the "CustomTool" from your resources file and creating a new, public class with the same full name as the resources file; you'd lose the ability to access the resources through the strongly typed class of course.

Regards,
Fernando
Aug 6, 2007 at 4:05 PM
Hi Fernando

Let me try. Thanks.

Regards
Alex