Ahmad Dar
Ahmad Dar

Reputation: 9

unable to view designer of windows form added as existing item

I have added a windows form to my visual studio 2013 project by using the option "Add an existing item". I only add the .cs file in the project and the rest of files (.Designer.cs, *.resx) are generated automatically. I can view the code but i m unable to view designer of this form. (i cant edit form by using toolbox). Any solution for this..?? Thanks

Upvotes: 0

Views: 919

Answers (3)

goast
goast

Reputation: 21

Open the project file (yourproject.csproj) in your favorite text editor.

Ensure that the entry that references the form in the project has a subtype of "Form".

Steps: Locate the line that includes said form in the project.

<Compile Include="Forms\Login.cs" />

Change to:

<Compile Include="Forms\Login.cs" >
  <SubType>Form</SubType>
</Compile>

Save the csproj file and open the project/solution.

Upvotes: 1

Ahmad Dar
Ahmad Dar

Reputation: 9

i found a solution.. All u need is to add the .cs file of the windows form (.designer.cs and .resx files will be added automatically). then close your solution and reopen it after a while. Your .cs file will be recognized as windows form by visual studio...

Upvotes: 0

Ric .Net
Ric .Net

Reputation: 5540

The best way to this is:

  • Add the windows form files (.cs, .designer.cs and .resx) to a directory in your solution, using windows explorer.
  • In the VS solution explorer make sure you set the 'Show all files' option.
  • Refresh the solution explorer using the refresh button.
  • Right click the file (which should already been recognized as windows form) and choose 'Include in project'

Upvotes: 0

Related Questions