Question: During a refactoring, I added a generic type parameter to `MyControl`, a class derived from [UserControl](http://msdn.microsoft.com/en-us/library/system.windows.forms.usercontrol.aspx). So my class is now `MyControl<T>`.

Now I get an error at runtime stating that the embedded resource file **MyControl`1.resources** cannot be found. A quick look with [.NET Reflector](http://en.wikipedia.org/wiki/.NET_Reflector) shows that the resource file is actually called **MyControl.resources**, without the **`1**.

At the start of the `MyControl<T>.InitializeComponent` method there is this line which is probably the one causing problems:

```
 System.ComponentModel.ComponentResourceManager resources =
    new System.ComponentModel.ComponentResourceManager(
       typeof(MyControl<>));

```

How do I force the `ComponentResourceManager` to use the embedded resource file `MyControl.resources`? Other ways to resolve this issue are also welcome.

Answer: 
Turns out you can override the resource filename to load by inheriting from `ComponentResourceManager` like this:

```
   using System;
   using System.ComponentModel;

   internal class CustomComponentResourceManager : ComponentResourceManager
   {
      public CustomComponentResourceManager(Type type, string resourceName)
         : base(type)
      {
         this.BaseNameField = resourceName;
      }
   }

```

Now I can make sure that the resource manager loads `MyControl.resources` like this:

```
 System.ComponentModel.ComponentResourceManager resources =
    new CustomComponentResourceManager(typeof(MyControl<>), "MyControl");

```

This seems to work.

**edit**: the above line is overwritten if you use the designer, because it is in the
generated code region. I avoid the designer and make use of version control tools to revert any unwanted changes, but the solution is not ideal.
The simplest and easiest workaround is to make a dummy class for the autogenerated `typeof()`. You do not need to inherit from it or even expose it to the outside:

```
// Non-generic name so that autogenerated resource loading code is happy
internal sealed class GridEditorForm
{
}

```

(In my experience, the time required getting the designer to work around generics was not worth the ideal coolness generics can provide. I won't be using generic windows forms or controls again.)