Felics Felics - 22 days ago 13
C# Question

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

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 in my C# file. How can I pass it, it's very annoying.

EDIT:

I want to have multiple classes in my file. I want to have some classes derived from TextBox that accept specific types of input. I'm not using the designer.

EDIT2:

class NumericTextBox : TextBox
{
protected override void OnTextChanged(EventArgs e)
{
...
}
}

Answer

You must have more than one classes in your file. Move your class up in the file so that it can be the first class in that file

Visual Studio requires class that was responsible for creation of file to be on top or first class of that file

Comments