Donate

Activate Or Show Windows Forms Missing Controls Including BindingNavigator In .NET 5 or .NET Core Winforms Application

Gents Good Day!

There was a question on forums on why the BindingNavigator control was either missing or grayed out in Visual Studio Toolbox of which the project's target framework is .NET 5. I decided to create a C# Windows Forms application using Visual Studio 2019 that targets the .NET 5 framework and infact, the BindingNavigator control is missing.
Activate Or Show Windows Forms Missing Controls Including BindingNavigator In .NET 5 or .NET Core Winforms Application
After searching the net, I found an interesting link in StackOverflow Activate missing Winforms controls in .Net Core 3.1 which is applicable to .NET Core 3.1. I applied the steps stated in the post's answer to the Windows Forms project that I created and it works. Below are the steps to do that.
1. Comment Application.SetHighDpiMode(HighDpiMode.SystemAware); code in Program.cs file.
static void Main()
    {
        //Application.SetHighDpiMode(HighDpiMode.SystemAware);
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }
2. Change TargetFramework to TargetFrameworks in the PropertyGroup node of your .csproj file and add .NET Framework 4.7.2 (net472) or 4.8 (net48) depending on what's installed on your machine.
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFrameworks>net472;net5.0-windows</TargetFrameworks>
    <UseWindowsForms>true</UseWindowsForms>
  </PropertyGroup>
3. Reload Project -> Save And Close the solution -> Open again the solution. The BindingNavigator control will now appear in the toolbox of your Windows Forms project.
Activate Or Show Windows Forms Missing Controls Including BindingNavigator In .NET 5 or .NET Core Winforms Application
Activate Or Show Windows Forms Missing Controls Including BindingNavigator In .NET 5 or .NET Core Winforms Application

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.