BUG: You receive an error message if you change the case of a control name on the form (814357)



The information in this article applies to:

  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual C# .NET (2002)

SYMPTOMS

You may receive an error message when you build a project on a Windows application if you do the following things:
  • Set the Localizable property of the form to True.
  • Set the Form Language property to a value other than default.
  • Change the case of a control name on the form.
You receive the following error message:
Resource transformation for file 'FormName.resx' failed. Item has already been added. Key in dictionary: "NewControlName.<Property Name>" Key being added: "ControlName.<Property Name>"
This bug occurs only when you change the case of a control name on the form. You may not receive the error when you change the name of the controls.

CAUSE

When you set the Form Language property to a value other than default, Microsoft Visual Studio .NET converts the language dependent properties to appropriate languages. These property values are stored in a resource file with .resx extensions. When you modify the name of a control, all the related keys are stored with the new name in the resource file, and Visual Studio .NET deletes the old key entries. When you change only the case of the control name, Visual Studio .NET adds the new keys entry, but it does not delete the old key entries. This bug occurs because the resource file contains more than one entry for the control.

WORKAROUND

To work around this problem, delete the old key entries in the resource (.resx) file. To do this, follow these steps:
  1. Open Visual Studio .NET.
  2. On the File menu, point to Open, and then click File.
  3. Locate the Form1.resx file, and then click OK.

    Form1.resx is displayed.
  4. Locate the original key values, and then manually delete them from the data list.

    For example, you have a button named Button1. You modify the name of this button to BUTTON1. The key values for both Button1 and BUTTON1 are in Form1.resx. Remove all the entries of Button1, and then rebuild the project.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Create a new Windows application by using Visual Basic .NET or Visual C# .NET.

    By default, Form1 is created.
  2. On the View menu, click Properties.
  3. In the Properties window, set the Localizable property to True.
  4. In the Properties windows, click Language, and then set the value to Japanese.
  5. From the toolbox, drag a button onto the form.
  6. Change the name of the button from Button1 to BUTTON1.
  7. On the Build menu, click Build Solution.

    You receive the error in the "Symptoms" section of this article.

REFERENCES

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

316643 BUG: The Resx file is not updated when you remove a control


Modification Type:MinorLast Reviewed:2/3/2006
Keywords:kbvs2005doesnotapply kbvs2005swept kbvs2002sp1sweep kbWindowsForms kberrmsg kbResource kbForms kbLocalization kbbug KB814357 kbAudDeveloper