I want to bind my comboBox through design but Visual Studio 2022 shows an error:
Microsoft Visual Studio
Error using the dropdown: The connection to the server has been lost.
Solution 1:
Whenever you are creating your project Select "Window Form App (.NET Framwork)". Then this error will never occure.
Reason: ADO.NET Entity Data Model are come up with .NET Framwork so if we want ADO.NET Entity Data Model then we have to choose "Window Form App (.NET Framwork)"
Solution 2: What if we have created our project without selecting "Window Form App (.NET Framwork)". Solution is to replace/add your App.config file with below code:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net48</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>False</UseWPF>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup>
<LangVersion>10</LangVersion>
<Nullable>enable</Nullable>
<NullableContextOptions>enable</NullableContextOptions>
<StartupObject></StartupObject>
<PackAsTool>False</PackAsTool>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Configuration" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
</ItemGroup>
</Project>
In above code we just selected the target framework .NET