I saved my project, but now I can't open it up in design view where you see all the buttons and stuff. Visual Studio 2012 Anyone know how?
You can double click directly on the .cs file representing your form in the Solution Explorer :
This will open Form1.cs [Design]
, which contains the drag&drop controls.
If you are directly in the code behind (The file named Form1.cs
, without "[Design]"), you can press Shift + F7 (or only F7 depending on the project type) instead to open it.
From the design view, you can switch back to the Code Behind by pressing F7.
My problem, it showed an error called "The class Form1 can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again. ". So I moved the Form class to the first one and it worked. :)
From the Solution Explorer window select your form, right-click, click on View Designer. Voila! The form should display.
Click on the form in the Solution Explorer
Just Shift+f7 and Design view will open OR Right-click on your form file and Click on View Designer
@Pierre's answer is not always applicable. When I messed up the files in the solution folder a bit (maybe add some code from outside which conflicts the GUI, I don't know precisely), then the Design View does not show up. In fact, my "Solution Explorer" is actually "Solution Explorer - Folder View". There is no object hierachy shown in the Solution Explorer, but just a file & folder view.
I had this problem in Visual Studio 2019 today. When I right-clicked a form or user control in Solution Explorer, there was no "View Designer Shift-F7" option. The "View Code F7" option was there, but not the Shift-F7 option. I noticed that I could view and work on the design view for two forms, that I opened before the problem surfaced. But Visual Studio would not let me open more design views.
My solution is: In another project, in the same solution, I created a new Windows Form. Now the "View Designer Shift-F7" is visible and working for all forms and user controls, in all projects in my solution. I deleted the latest new form, and Design View still works. This solved the problem for me.
If non of the above worked do this Tools-> Option-> XAML Designer -> Enable XAML designer Then you need to restart Visual sudio.
For me, the issue was that I had added a class before the partial form class in code behind, but removing it was not enough to get the designer option back in the solution explorer.
I also had to edit the project file to add <SubType>Form</SubType>
under the compile include for the file.
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
© 2022 - 2024 — McMap. All rights reserved.