Nick O
Nick O

Reputation: 3826

Form showing as a class in Solution Explorer

I have a form in my project that is showing up as a class in Solution Explorer. This is causing a problem since I can't get to the designer. Any ideas on how to fix this?

Upvotes: 4

Views: 2786

Answers (7)

Falk
Falk

Reputation: 121

My help was that the form has to be the first class in the file. No classes above!

Upvotes: 0

Sabbir Ahmed Saif
Sabbir Ahmed Saif

Reputation: 191

Simply select the form and press Shift+F7. You'll find your form.

Upvotes: -1

jayastuhan
jayastuhan

Reputation: 11

remove the reference of form related dll and again add and build the project

Upvotes: 1

Craig T
Craig T

Reputation: 1071

You can fix the problem manually by editing your csproj file.

Open it in notepad and search for the filename of the class. You should see something like this...

<Compile Include="frmTest.cs" />

Add a subtype called 'Form' like this...

<Compile Include="frmTest.cs">
    <SubType>Form</SubType>
</Compile>

Reload the project. Visual Studio should now identify the file correctly.

Upvotes: 7

Chris Dunaway
Chris Dunaway

Reputation: 11216

One thing that has worked for me in the past is to just add another blank form to the project and that seemed to make the other form show up as a form. You can then delete the blank form.

I don't know if it will work for you, but it only takes a few moments to try it.

Chris

Upvotes: 1

jwarzech
jwarzech

Reputation: 6665

Try seeing if there are any hidden files by using the the 'Show All Files' button. Sounds like your project file might not have all of the files added to it.

Upvotes: 1

Anton Gogolev
Anton Gogolev

Reputation: 115877

Press F7 when in code editor to get to the designer. And restarting Visual Studio usually helps.

Upvotes: 0

Related Questions