Key "UserID" does not exist in the appSettings configuration section
All of a sudden I start getting this error while trying to open 2 out of 10+ forms in a Window Forms application in the designer.
To prevent possible data loss before loading the designer, you must resolve the following errors: The "UserID" key does not exist in the appSettings configuration section.
It worked fine and I don't remember making any significant changes.
The key is of course in appSettings ok and has always been, and the app builds and executes as expected. Only the design view is not available for these two forms.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Server" value="MYSERVER" />
<add key="DataBase" value="MYDB" />
<add key="UserID" value="MYUSER" />
<add key="PassWord" value="MYPASS" />
</appSettings>
</configuration>
One is just a form, the other is a UserControl. None of these inherit from abstract classes or anything like that. Restarting or restarting Visual Studio doesn't help yet.
Any ideas on how to fix it?
source to share
And finally, here's what the designer is REALLY complaining about: I had a stored procedure call directly from User InitializeComponent (). While it may not be a good idea (separate material from the question?), I have to say that the error was not presented to me in the best way ...
source to share
Okay, there is something in common with these two forms - they both use the same UserControl, and there is another error in the designer that says "The variable" myControl "is either not declared or has never been assigned." (where myControl is User Control). Maybe I should manually remove it and try re-adding it through the constructor.
source to share