I have a fairly simple form with a few static controls. One of the Labels is retrieving its .Text
value from a .resx resource file for some reason. I didn't intentionally do anything to cause that. The Form's InitializeComponent()
has this as its first line:
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form_WingInertiaListPrompt))
Where Form_WingInertiaListPrompt
is the name of the Form. Further down, the problematic label has this line:
Me.Label1.Text = resources.GetString("Label1.Text")
And the .resx Resource File contains the data that gets assigned to the .Text
property at runtime:
<data name="Label1.Text" xml:space="preserve">
<value>New Select Critical Wing Loads data found. Would you like to automatically generate Wing Inertia cases for the critical wing cases?
This will automatically populate the Case Num, Nz, and Nx fields for each load case.</value>
</data>
Whatever I type in the .Text
property in the Designer gets overwritten by the .resx content at runtime.
The Form in question is a copy I made of a similar form in this same Project using Abdellah OUMGHAR's answer from this post. The Label.Text in my new form that I want to change keeps defaulting to the value from the original Form that I copied. That Form is doing the same thing, retrieving the value from its own .resx file. I don't know how that happened. On each form, only one Label behaves this way, all other labels display the value I assign to them in the Designer interface.
I tried unloading the solution and manually editing the designer file to remove the Dim resource...
line and removing the <data>
tag and all its contents from the .resx file. When I load up the solution, I can update the text in the designer, but then when I run the program all my manual edits are undone at runtime and the original .resx value is shown.
I just did an experiment and it looks like the length of the string is what determines whether the string is in the .resx
file or not.
Any string over 200 characters gets moved to the .resx
file.
Try making your .Text
value really short.