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?
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