PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Using "resources" files
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Using "resources" files
![]() |
Using "resources" files |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
I am currently trying to understand how to use resource files in a VB.NET windows application. I understand the general concept, but it think there is a detail I am missing. BTW, the resource file is not used for Globalization here. I have a simple form with a button and a textbox. I have added a .resx file in my project. This is the code that handles the button click: Dim rm As New ResourceManager(GetType(Form1)) Me.TextBox1.Text = rm.GetString("2") // 2 is the name of the string element in the .resx file The ".resources" file seems to be generated properly in the OBJ directory, but when I click on the button, nothing appear. What do I miss? thank you! Dina |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi,
> I have a simple form with a button and a textbox. I have > added a .resx file in my project. This is the code that > handles the button click: > Dim rm As New ResourceManager(GetType(Form1)) > > Me.TextBox1.Text = rm.GetString("2") > // 2 is the name of the string element in the .resx file The resource-file associated with the form is a so-called Windows Resource File. It can't contain string-resources. Well, it can, but the designer will regenerate the resource file on building and it'll be gone. You need to Add New Item and add a Resource File. Enter you string in there. Then, do what you did above. You'll have to modify the constructor-parameters, I think. > The ".resources" file seems to be generated properly in the OBJ directory, but when I click on the button, nothing > appear. What do I miss? If you have several assemblies in your solution and the resource-files are not in the main assembly (startup-project), you'll have to copy the folders with resource files into the main assembly's bin/debug directory. |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

