Adding resource files to a form or user controle

  • Thread starter Gabriel Lozano-Morán
  • Start date
G

Gabriel Lozano-Morán

First of all sorry for the cross-posting but I am not sure wether this
belongs under internationalization or just general.

Environment:
Visual Studio .NET 2003

Problem:
Newly added and renamed resource files are not automatically linked to the
object they belong by the IDE

Steps to reproduce:
1) create a new C# or VB.NET Windows application, you will have a standard
form named Form1.cs/Form1.vb
2) add a new resource file and name it Form1.nl-BE.resx
3) you will see that the resource file is at the same level as the Form1
meaning that it is not linked by the IDE to Form1

Workaround:
4) now using Windows Explorer move the Form1.nl-BE.resx to another folder
5) refresh the project in Visual Studio IDE
6) Form1.nl-BE.resx will be marked as missing, remove the file
Form1.nl-BE.resx from the project
7) move the Form1.nl-BE.resx back to the same folder as Form1.cs
8) refresh the project
9) show all files
10) you will see that the Form1.nl-BE.resx resource file has been linked to
Form1 and has become a child node of Form1
11) include the Form1.nl-BE.resx in the project

Question:
Why doesn't the IDE automatically link the resource file to the Form1 when
you first add it to the project?

Regards

Gabriel Lozano-Morán
 
R

Rolf Molini

Gabriel,

I could not reproduce your workaround. Even after moving and removing the resource-file (.resx) stays besides the Form

And I think this is logical. In Solution Explorer you add a resources-file to the project, not to the Form. What if your project
contains several Forms?

Besides, you don't have to "link" the resource-file to a certain form. As long as you follow the naming conventions you can access
the content of the resource-file out of the generated satellite-assemblies from anywhere within your project.



Regards
Rolf
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top