I'm having a problem with the windows form application . When I create the windows form application , it displays the source code for the form but not the designer layout
-
1Be sure to pick the correct project template. VS2019 version 16.3.x will let you create a .NETCore project that targets Winforms, the designer however is not done yet. You need to select .NETFramework – Hans Passant Oct 14 '19 at 17:13
-
If you selected .NET Framework, you can try to open the designer using hotkey "Shift+ F7" – 大陸北方網友 Oct 15 '19 at 02:04
-
1My suspicion is that you created a new WinForms project targeting .NET 3.0, which as Hans mentioned, requires a different winforms designer (still in preview), but can be downloaded from https://aka.ms/winforms-designer. You can read more about it here: https://devblogs.microsoft.com/visualstudio/dot-net-core-support-in-visual-studio-2019-version-16-3/ Alternatively, create your winforms project targeting the full .NET Framework instead of .NET Core 3.0. – Ed Dore Oct 15 '19 at 17:59
-
@KyleWang, thankyou.. I tried to reset to default settings and also tried shift+f7, but nothing worked . So I moved to visual studio community 2017 – HRC Oct 16 '19 at 13:31
-
@EdDore's comment solved my issue. You should create a `Windows Form App (.NET Framework)` instead of a `Windows Form App (.NET Core)` – JVE999 Oct 28 '19 at 18:57
8 Answers
To enable the designer, download and install the Windows Forms .NET Core Designer VSIX package.
See article: https://devblogs.microsoft.com/dotnet/introducing-net-core-windows-forms-designer-preview-1/

- 3,324
- 2
- 18
- 31
-
So at this point it seems you need to have the VS 2019 Preview 16.5. If you have the latest non-Preview (16.4.2 as of today), they say it won't work. – Andrew Dec 20 '19 at 17:25
I had the same problem. The following steps helped me
- Remove any other classes than the Form class in the yourformname.cs file
- Unload the project and right click on the project and choose edit project
- Make sure yourformname form has the SubType set to form
<SubType>Form</SubType>
and save the file - Reload the project
-
1@JohnnyWu Something like this: https://stackoverflow.com/a/22600109/945456 – Jeff B Aug 24 '20 at 22:08
As of version 16.8.0 Preview 2.1 I have found that I have to turn off this setting and restart and add my form. Once added, I can turn it back on, restart and work.

- 29,542
- 12
- 100
- 122
This happened to me as well.
I was using the wrong template (.net core when I wanted to use the full .net framework which allows you to edit the form as you were used to in vs 2017 or previous versions).

- 1,199
- 1
- 10
- 25
I am using 16.6.5 and it appears after you first created the project, you have to run the project in order for IDE to pickup the form.cs.

- 1,297
- 15
- 31
Certainly in WinForms one thing to check is you haven't declared any other classes in the form class file before the form itself. The example below will prevent the designer loading the form or even giving you the menu option to 'View Designer'
// Don't do declare a class here
public class MyNewClass
{
}
public partial class MyForm: Form
{
public MyForm()
{
InitializeComponent();
}
}

- 191
- 1
- 3
Removing inner class makes my form back to Visual Studio Design display.
For example, this Form2 will be regarded as normal class if you uncomment its inner class.
namespace XXX {
//public class EventMsgXXX:EventArgs {
// public string mmm {get; private set;}
// public EventMsgXXX(string str) {
// mmm = str;
// }
//}
public partial class Form2:Form {
public event EventHandler<EventMsgXXX> OnCallback;
public Form2() {
InitializeComponent();
}
private void btn_Click(object sender,EventArgs e) {
EventHandler<EventMsgXXX> handler = OnCallback;
if (handler != null) {
EventMsgXXX arg = new EventMsgXXX("HELLO");
handler(this, arg);
}
}
}
}

- 145
- 1
- 6
I have tried the suggestion by Danielle, but it appears to be a circular reference to other articles Olia. A plethora of comments also say that what Olia is suggesting, does not work, and at the end, you need to do the following.
Solution
Download Visual Studio 16.6.0 Preview 2.1 from here. This works.