Trashed project?

philprice

Well-known member
Joined
Mar 21, 2003
Messages
116
Location
Hull, UK
My project just did this to me,

"The variable Controls is either undeclared or was never assigned

about 100 times in the error list, i cant figure out why, along with a load of other all repeated, and i didnt do anything, any ideas what wrong?
 
I know your pain!

Yeah... I lost hundreds of hours of my work because of the same problem. But! It is possible to fix. At least in some cases.
Just a few minutes ago Visual Studio destroyed 2 of my quite complecated forms.
It seems that the problem is on the top of the documents. For some reasons this version of VS SOMEtimes stops recognize automatically generated variables if you place custom declarations in between them. Pardon my English. In other words if you have something like this:

........
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label11;
private ArrayList list;
private int x;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Label label12;
.................
where 2 top and 2 bottom lines were generated by studio then there is a chance that at some point point of time you will get a lot of complains about those 2 variable at the bottom.
So, stick all ""auto"-variable together and it is very likely that your problem will disapear.

Vadim
 
Any other recommendations as to how to "jolt" VS.NET into stopping itself from being retarded? Ive also lost many hours of work do to random incidents of VS.NET eating up my code (like the time it swallowed hundreds of lines of binding code because it forgot the members of a dataset). But now Im getting errors very similar to those mentioned by the original poster. I get

The variable Controls is either undeclared or was never assigned

or

Duplicate declaration of member Location

as an error in the form editor, though the code is all intact and it compiles and runs correctly. Ive been getting this error in various forms for the last few days now, seemingly at random itll occur and clear itself up. Ive tried to fix broken forms by deleting them and pasteing all of their code into a new form. That worked once before, but didnt work just recently. Anyone have any other workarounds to this, or perhaps know of a secret fix that eliminates all the bugs in this program?

-Q
 
:cool: I managed to work around this... (after about four hours of frustration).

What I saw is

a) it has nothing to do with your source code. I had the project duplicated on my development machine and on a laptop. Exactly the same form code worked in one place, but gave these problems in the other place. Copying the good source code into the project with problems made no difference at all.

b) I had the solution under source control. I finally just checked everything in, deleted the whole project tree on my dev machine, and checked it all out again in pristine form, and the problem was gone...

---------------------

What I infer from this is ...

a) If you have a source control system, start afresh.

b) If not, you may salvage your work by copying all the source code to a brand new folder and opening a new project on it.

c) There are probably some project files or pre-built headers or cache files that somehow got screwed. If we could find out which, or why, we could probably just removing them. But I know not ...


peter
 
Back
Top