The class foo can be designed, but is not the first class in the file error

后端 未结 5 1764
囚心锁ツ
囚心锁ツ 2021-02-20 08:36

I have this

The class foo can be designed, but is not the first class in the file

error after adding foo class derived from TextBox

5条回答
  •  难免孤独
    2021-02-20 09:05

    The error message is pretty clear. You have a .cs file containing multiple classes. Move each class to it's own file and you should be fine.

    EDIT: If you insist on having all classes in the same file, then put the foo class at the top. Order matters- by convention, the designer uses the first class in the file for controls. You cannot have multiple control classes in the same file without seeing this error.

提交回复
热议问题