Reputation: 335
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.
Upvotes: 2
Views: 2780
Reputation: 335
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
Upvotes: 2
Reputation: 17080
First try the easy solution:
do Build->Rebuild Solution. Close Visual Studio, re-open.
It can happen if the user control threw an exception during design time construction. It only cleared up after Visual Studio restart. (Visual Studio 2008 w/SP1)
If this fails so you probably has a reference to a variable, such as Button1, that was never declared or assigned. If it was not assigned, you will get a warning, not an error.
To correct this error: Declare or assign the variable specified in the error message.
http://msdn.microsoft.com/en-us/library/4008y84t.aspx
Upvotes: 0