Windows Forms Database Project Problem with Data Sources

Nicholas Piazza 536 Reputation points
2021-09-16T16:38:41.54+00:00

I am trying to setup the example Windows Forms SampleDatabaseWalkthrough example in Microsoft document
https://learn.microsoft.com/en-us/visualstudio/data-tools/create-a-sql-database-by-using-a-designer?view=vs-2019#add-a-data-source. However, when I try to open the Data Sources window as indicated in the instructions, I get the message:
This window is not supported for the selected project. For steps to enable data binding, please visit:
https://aka.ms/WinForms/DataBinding
However, that page has a large number of links that would seem to take forever to read. Could you give me a more direct answer to the project. Here is a copy of the project file:

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<LangVersion>9.0</LangVersion>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

</Project>
I have already created the SampleDatabase MDF and LDF files.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,524 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 114K Reputation points
    2021-09-16T16:49:15.373+00:00

    According to documentation, you should create a different kind of projects: “Windows Forms App (.NET Framework)”.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful