Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable is either undeclared or was never defined

Status
Not open for further replies.

ianwin

Programmer
Jul 5, 2005
44
US
I am currently running VS2003 on XP and I recently had to look at making a change to a project after it had been working ok for several months.

When I opened the project I get the error "Variable is either undeclared or was never defined" on several custom controls I have on the form. When I view the form in design view the controls do not appear however in the windows region in the code view all the declarations look correct. This program runs ok but I am unsure of making changes and rolling them out to users when the development environment appears unstable.

The same question was asked in thread796-1305600 however there was no answer has anyone solved this issue?

-Ian
 
Try cleaning and rebuilding the procject. I was getting a similar error in VB 2005 with some of my custom controls, it just says "The form cannot be displayed. Most errors can be fixed by rebuilding the projeect..."

-The answer to your problem may not be the answer to your question.
 
I have tried rebuilding the project and checked that the references are correct but the problem still persists.
 
Have you cleaned the project? Like i said i was getting something similar for a while. I had to actually clean then build rather than just rebuilding. As well, make sure none of the files are open when you clean.

Do you have all the controls as "managed" code, or are you just using references to .dlls?

I you are using references to dll's then try to repoint your references. I had that issue as well with some 3rd party stuff i was using.

-The answer to your problem may not be the answer to your question.
 
Did you figure this one out?

-The answer to your problem may not be the answer to your question.
 
I was not sure what you meant by cleaning the code?

I have tried having the custom controls as managed code and as referenced dll's bit this did not seem to make any difference.
 
Are you using Visual Studio 2k3 or 2k5? I have 2k5 with .Net 2.0

Under the build menu i have a Clean Solution option, with basically wipes all the compiled code out. you should be able to have your custom controls as managed code, either directly within the project or as a referenced project. If you have the custom controls as parts of a separate project you may want to build that project before attempting to build you main project.

Side note, have you renamed any of your custom controls?

-The answer to your problem may not be the answer to your question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top