Search code examples
c#winformsuser-controlsdesignview

Unable to open winform with user control in design view


In a project I'm working on, I've moved all the winforms' resource files (with strings only) to a resource dll, which also has a static class that loads all the resource file strings to memory at project start, and each form gets its strings from it.

I have one winform with a couple of user controls, that also access that dll for their strings. When I try to open that form in design view I get the following error for each user control:

"The variable 'control_name' is either undeclared or was never assigned"

I can still run the project without any problem.

I've tried to call the dll from both the user controls' constructors and Load events but neither of the cases worked.


Solution

  • As I've mentioned in an earlier comment, I managed to solve the problem. Instead of accessing the resource dll from within the usercontrol, I changed each of the controls' functions to public and called those functions from the winform