Localization in Classes

P

Pieter

Hi,

I'm using VB.NET with VS.NET 2005. I'm using the standard localization to
localize my Forms and UserControls, which works perfect.

BUT: I also want to localize the (error)messages I'm using in my CLASSES.
But there isn't a .resx file created for my classes. Is there any way to
generate somewhere such a set of files to be able to handle easily
localization inside classes? Or what is the best practice to do this?


Thanks a lot in advance,


Pieter
 
F

Fred

Dans : Pieter disait :
Hi,

I'm using VB.NET with VS.NET 2005. I'm using the standard
localization to localize my Forms and UserControls, which works
perfect.
BUT: I also want to localize the (error)messages I'm using in my
CLASSES. But there isn't a .resx file created for my classes. Is
there any way to generate somewhere such a set of files to be able to
handle easily localization inside classes? Or what is the best
practice to do this?

Try this.
Add a resource file to your project and give it the name of the file
containing your class (keeping the extension .resx).
Then VS will attach it to the class file and generate a designer file to
access the resources.
You can add several resource files, with the culture name before the
extension.

ex : MyClass.vb
Add MyClass.resx -> MyClass.designer.vb
Add MyClass.fr-BE.resx

You access the resources with My.Resources.MyClass.ResourceName
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top