Can't Find Windows Forms Application for C++

Can't find Windows Forms Application for C++

There are no C++ Windows Form templates in Visual Studio 2015. As I see it, you have two choices:

  • When creating a new project, You will see an online dropdown, click that and try to search for "C++ Windows Forms".
  • Create an empty C++ CLR project and add a Windows Forms to it. This link puts it like this (credit to the onContentStop, the user who posted this):

    1. Make a "CLR Empty Project".
    2. Press Ctrl-Shift-A and create a Windows Form (under UI).
    3. Inside the CPP file that is created, paste this code, replacing anything in square brackets except [STAThread] with the appropriate names:

      #include "[FORM NAME].h"

      using namespace System;
      using namespace System::Windows::Forms;

      [STAThread]//leave this as is
      void main(array<String^>^ args) {
      Application::EnableVisualStyles();
      Application::SetCompatibleTextRenderingDefault(false);
      Application::Run(gcnew [PROJECT NAME]::[FORM NAME]);
      }
    4. Right click your project in the Solution Explorer and click Properties.

    5. Under Configuration Properties > Linker > Advanced, change Entry Point to "main" (without quotation marks).
    6. Under Configuration Properties > Linker > System, change SubSystem to "Windows (/SUBSYSTEM:WINDOWS)" (without quotation marks).

I didn't find windows form application C# in visual studio 2017

In VS 2017, workloads to be downloaded needs to explicity selected. To install win forms workload, please follow following step

Launch visual studio installer -> click modify -> Select .Net desktop development workload -> click modify

Link has exact steps

Visual Studio 2017 - can't find Visual C++ Windows Forms

Ok, I found a working way to creating Windows Forms in Visual Studio 2017.

  1. Create new CLR Empty Project:

Sample Image


  1. Add .cpp file for main function.

  2. In project add new item from UI->Windows Forms:

Sample Image

(If we didn't add main loop before the error will occur)


  1. Now we can add new elements to form from the Toolbox to the left (i spent measurable time looking for that).

Sample Image


  1. To run application we have to declare this instead of main function:

Sample Image

Also we need to tell Visual Studio that we are making Windows Application instead of Console Application:

Sample Image

Can't use System.Windows.Forms

A console application does not automatically add a reference to System.Windows.Forms.dll.

Right-click your project in Solution Explorer and select Add reference... and then find System.Windows.Forms and add it.

Missing Windows Form Templates in newly Installed Visual Studio 2015

Try to:

  1. Close Visual Studio.

  2. Open "visual studio command prompt" and run the following command:

    devenv /installvstemplates

Source

Can't open design view on Visual Studio 2019 C# Windows Form Application

To check the target framework of your project, you can follow Project -> Properties... Application. And then you can see the target in the page.

Sample Image

If the target is .Net Framework, you can follow the steps provided by Flydog57.

If it is a Windows Forms App(.Net Core), there is no Designer by default.

The .NET Core Windows Forms designer is available with the Visual Studio 16.5 Preview 1. So you can try to update Visual Studio to Visual Studio 16.5 Preview 1 or a later version.

For more details, you can refer to this blog.

Updates to .NET Core Windows Forms designer in Visual Studio 16.5 Preview 1



Related Topics



Leave a reply



Submit