1

I've added a type argument to my form by adding it to both Form1.cs and Form1.Designer.cs:

partial class Form1<T> { ... }

This works until I add any resources to my form, like an icon. When I do, this line gets added:

ComponentResourceManager resources = new ComponentResourceManager(typeof(Form1));

If I change this to say typeof(Form1<T>) it compiles but at runtime I get

Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "My.Assembly.Form1'1.resources" was correctly embedded or linked into assembly "My.Assembly" at compile time, or that all the satellite assemblies required are loadable and fully signed.

Trying typeof(Form1<T>).GetGenericTypeDefinition() also fails. How can I use a generic form's resources?

dlras2
  • 8,416
  • 7
  • 51
  • 90
  • possible duplicate of [Fix embedded resources for a generic UserControl](http://stackoverflow.com/questions/1627431/fix-embedded-resources-for-a-generic-usercontrol) – dlras2 Jun 11 '12 at 16:54

1 Answers1

1

There is already a issue raised here - http://connect.microsoft.com/VisualStudio/feedback/details/115397/component-resource-manager-doesnt-work-with-generic-form-classes

But, SO has a solution to this. See here -

https://stackoverflow.com/a/1627605/763026

Community
  • 1
  • 1
Angshuman Agarwal
  • 4,796
  • 7
  • 41
  • 89
  • Thank you, I didn't find that existing solution, but it works for forms as well as UserControls. – dlras2 Jun 11 '12 at 16:53