none
The designer could not be shown for this file because none of the classes within it can be designed.

    Question

  • It is an instance of dealing with the unknown. I have been getting this warning for about three weeks with no ill effect on my development whatsoever. I was wondering what it meant but decided to ignore it for a time being. Then all of a sudden today I could not display the app in the designer at all with an error message (with an error number) which I neglected to save. I simply closed the VS2005 and restarted it. That fatal error disappeared but the warning remained. I am wondering what it means and if I should take care of fixing the problem. This is the full text:

    Warning 1 The designer could not be shown for this file because none of the classes within it can be designed.  The designer inspected the following classes in the file:

     Class1 --- The base class 'System.Object' cannot be designed.
     BB --- The base class 'System.Object' cannot be designed.
     BuildNewTabsPages --- The base class 'System.Object' cannot be designed.
     LowerLabelsAndPushes --- The base class 'System.Object' cannot be designed.
     FormClassPages --- The base class 'System.Object' cannot be designed.  0 0

    The talk here is about an important but auxiliary file where I keep various classes that do not directly participate in interaction with the form controls. It is a matter of convenience.

    The app works just fine and I continue to improve and augment it but now I am getting iffy.

    What shall I do?

    Thanks.

    Monday, February 12, 2007 2:56 PM

Answers

  • Ideally, you should have a separate file for each class. In this instance, VS2005 thinks that the .cs file you are trying to open contains a visual class such as a Form or UserControl, but it can't actually find a class of that type in the file. Did you perhaps create the .cs file as a Form, but then remove the actual form class from it and leave only the non-visual classes? If so, break those classes out into their own files and remove the offending .cs file.
    Monday, February 12, 2007 3:02 PM

All replies

  • Ideally, you should have a separate file for each class. In this instance, VS2005 thinks that the .cs file you are trying to open contains a visual class such as a Form or UserControl, but it can't actually find a class of that type in the file. Did you perhaps create the .cs file as a Form, but then remove the actual form class from it and leave only the non-visual classes? If so, break those classes out into their own files and remove the offending .cs file.
    Monday, February 12, 2007 3:02 PM
  •  Mark_Rendle wrote:
    Ideally, you should have a separate file for each class. In this instance, VS2005 thinks that the .cs file you are trying to open contains a visual class such as a Form or UserControl, but it can't actually find a class of that type in the file. Did you perhaps create the .cs file as a Form, but then remove the actual form class from it and leave only the non-visual classes? If so, break those classes out into their own files and remove the offending .cs file.

    Thank you very much. You may be clairvoyant on that point (Did you perhaps create the .cs file as a Form?). Too many things have taken place over the few months I've worked with it, I do not quite remember all of them,  but I think the chain of events was as follows: I created this file as a nonvisual class file, then included a class in it and it was named partial class Form1, then I changed that to an "independent" class and this is how it stands now. It is possible that the warning first appeared when I reverted from a partial to a regular class but I am not quite sure.

    Well, creating so many files for so many classes will be a two hour work but perhaps I should do it.

    Thanks.

    Monday, February 12, 2007 4:11 PM