Microsoft KB Archive/814732

= BUG: Windows Forms Resource Editor cannot open inherited forms =

Article ID: 814732

Article Last Modified on 5/16/2007

-

APPLIES TO


 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual Basic .NET 2002 Standard Edition
 * Microsoft Visual C# .NET 2003 Standard Edition
 * Microsoft Visual C# .NET 2002 Standard Edition

-



SYMPTOMS
The Windows Forms Resource Editor (Winres.exe) is a visual layout tool that helps localize Windows Forms. You use the .resource file or the .resx file as input to Winres.exe. When you use Winres.exe to edit inherited Windows Forms, you may receive the following error message:

An error occurred while loading the document. Fix the error, then try loading the document again. The error message follows: Value does not fall within the expected range.



CAUSE
WinRes.exe uses the assembly mentioned in the .resource file or .resx file to edit the form. The file contains an entry for the inherited class and for the assembly name (for example, System.Windows.Form). When the resource is loaded, WinRes.exe checks for assembly in the Global Assembly Cache (GAC), and then displays the resource by instantiating the object. However, for inherited Windows Forms, the entry in the file is the inherited base form, and the assembly name is the application name. The error occurs because WinRes.exe does not find the assembly in the GAC or in the directory where WinRes.exe is located when it reads from the inherited Windows Forms file.



WORKAROUND
To work around this issue, use one of the following methods:   Add the assembly in the GAC by entering the following command: gacutil –I 

-or-


 * Copy the assembly in the directory where WinRes.exe is located. For example, put the assembly in C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.



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.
 * 1) On the View menu, click Properties.
 * 2) In properties windows, click Localizable, and then set the value to True.
 * 3) On the Build menu, click Build Solution.
 * 4) In Solution Explorer, right-click Project, point to Add, and then click Add Inherited Form.
 * 5) On the Add New Item window, click Open.
 * 6) On the Inheritance Picker window, click OK.

Form2 is added to the project.
 * 1) In the Properties windows, click Localizable and set the value to True.
 * 2) On the Build menu, click Build Solution.
 * 3) Open the Visual Studio .NET command prompt, type winres, and then press the ENTER key.

Winres.exe is opened.
 * 1) On the File menu, click Open.
 * 2) Click to select Form2.resx, and then click Open.

The error in the &quot;Symptoms&quot; section of this article is displayed.

