views:

408

answers:

3

Hi,

i implement a big form in winforms c# with visual studio 2008. after working fine for a big portion of the dialog it start showing a lot of error masseges as in the title when i try to open the designer

"The variable is either undeclared or was never assigned"

i got this for a lot of controls that worked fine before. i think it happens with custom control that i use

any clue?

thanks, tal

Dec 20th 2009

hi all,

still dont have a solution. does anyone can help?

A: 

Check your designer.cs file. It may be missing control declarations.

Does your code build and run?

Rezler
yeah... only the author does not specify the used language :)
serhio
He says c# - "i implement a big form in winforms c#"
Rezler
thanks for the reply.yes the code compile and run.how do i check the designer.cs?what control declarations should be made?Tal
tal
A: 

First recommendation is do not use any complicated logic in the form constructor, but in the form's Load event(or overrides of the OnLoad method).

The designer uses the code of constructor to display the form, and if you have errors your form will be "undisplayable" in the VS designer.

Secondly, every time you have problems in the designer, close it and rebuild your form's project. Verify the errors and warnings in the error list Window. After fixing it, reopen your form in desig mode.

serhio
i only has InitializeComponents in the constructor
tal
see my last edits in the answer.
serhio
A: 

found a working solution:

the initial problem happend when my custom controls and the dialog were in the same dll/project/assembly.

i created a separated wondows control dll for all the custom control and ... designer showed the dialog

tal