Tutorial :Winform Not Displaying in Designer



Question:

I have a Managed C++ WinForm that suddenly stopped showing in the VS 2005 designer. The error it shows is

Could not find type 'int'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built.

I don't even know where to start with this one. Does the designer only access the InitializeComponent(void) method when rendering the form? So my question is: where do you start troubleshooting designer errors?

EDIT: I forgot to mention that this code builds and runs perfectly. It only shows an error in the windows forms designer.


Solution:1

This is troubleshooting for C# but I'd assume a couple of the points mentioned here would help.

What's the state of play with "Visual Inheritance"


Solution:2

This is usually caused by a syntax error somewhere in the code that causes the designer to be unable to run the form to render it. The best method for this is ofent sadly just reading the code looking for the problem extra brace, missing string etc. The good news is that it is most likely easy to find since you know that it preceeds the INT in the error message.

Some possibilities: * I cause this usually by accidentally hitting the keybaord and putting some extra characters at the top of a file * Extra braces that make the class uncompilable - missing quotes, semicolons * Something typed at the top that messes up a common include/using statement

Diagnostics * Sometimes you can find this by dogin a build and seeing what lione is flagged with an error and then looking around it. * More often then not I have to just open the source file and scan through it looking for the problem.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »