What is Windows Forms - Windows Forms .NET (2023)

  • Article
  • 6 minutes to read

Welcome to the Desktop Guide for Windows Forms, a UI framework that creates rich desktop client apps for Windows. The Windows Forms development platform supports a broad set of app development features, including controls, graphics, data binding, and user input. Windows Forms features a drag-and-drop visual designer in Visual Studio to easily create Windows Forms apps.


The Desktop Guide documentation for .NET 6 and .NET 5 (including .NET Core 3.1) is under construction.

(Video) Intro to Windows Forms (WinForms) in .NET 6

There are two implementations of Windows Forms:

  1. The open-source implementation hosted on GitHub.

    This version runs on .NET 5+ (and .NET Core 3.1). The Windows Forms Visual Designer requires, at a minimum, Visual Studio 2019 version 16.8.

    The latest version of Windows Forms is for .NET 6 using Visual Studio 2022 version 17.0.

  2. The .NET Framework 4 implementation that's supported by Visual Studio 2022, Visual Studio 2019, and Visual Studio 2017.

    .NET Framework 4 is a Windows-only version of .NET and is considered a Windows Operating System component. This version of Windows Forms is distributed with .NET Framework.

    (Video) WinForms in Visual Studio 2022 (Windows Forms Getting Started)

This Desktop Guide is written for Windows Forms on .NET 5 and later versions. For more information about the .NET Framework version of Windows Forms, see Windows Forms for .NET Framework.


Windows Forms is a UI framework for building Windows desktop apps. It provides one of the most productive ways to create desktop apps based on the visual designer provided in Visual Studio. Functionality such as drag-and-drop placement of visual controls makes it easy to build desktop apps.

With Windows Forms, you develop graphically rich apps that are easy to deploy, update, and work while offline or while connected to the internet. Windows Forms apps can access the local hardware and file system of the computer where the app is running.

To learn how to create a Windows Forms app, see Tutorial: Create a new WinForms app.

Why migrate from .NET Framework

Windows Forms for .NET 6.0 provides new features and enhancements over .NET Framework. For more information, see What's new in Windows Forms for .NET 6 and .NET 5. To learn how to migrate an app, see How to migrate a Windows Forms desktop app to .NET 5.

Build rich, interactive user interfaces

Windows Forms is a UI technology for .NET, a set of managed libraries that simplify common app tasks such as reading and writing to the file system. When you use a development environment like Visual Studio, you can create Windows Forms smart-client apps that display information, request input from users, and communicate with remote computers over a network.

(Video) Learn C# with CSharpFritz - Getting Started with Windows Forms

In Windows Forms, a form is a visual surface on which you display information to the user. You ordinarily build Windows Forms apps by adding controls to forms and developing responses to user actions, such as mouse clicks or key presses. A control is a discrete UI element that displays data or accepts data input.

When a user does something to your form or one of its controls, the action generates an event. Your app reacts to these events with code, and processes the events when they occur.

Windows Forms contains a variety of controls that you can add to forms: controls that display text boxes, buttons, drop-down boxes, radio buttons, and even webpages. If an existing control doesn't meet your needs, Windows Forms also supports creating your own custom controls using the UserControl class.

Windows Forms has rich UI controls that emulate features in high-end apps like Microsoft Office. When you use the ToolStrip and MenuStrip controls, you can create toolbars and menus that contain text and images, display submenus, and host other controls such as text boxes and combo boxes.

With the drag-and-drop Windows Forms Designer in Visual Studio, you can easily create Windows Forms apps. Just select the controls with your cursor and place them where you want on the form. The designer provides tools such as gridlines and snap lines to take the hassle out of aligning controls. You can use the FlowLayoutPanel, TableLayoutPanel, and SplitContainer controls to create advanced form layouts in less time.

Finally, if you must create your own custom UI elements, the System.Drawing namespace contains a large selection of classes to render lines, circles, and other shapes directly on a form.

(Video) How To Create A Windows Form App In .NET Framework Part 1

Create forms and controls

For step-by-step information about how to use these features, see the following Help topics.

  • How to add a form to a project
  • How to add Controls to to a form

Display and manipulate data

Many apps must display data from a database, XML or JSON file, web service, or other data source. Windows Forms provides a flexible control that is named the DataGridView control for displaying such tabular data in a traditional row and column format, so that every piece of data occupies its own cell. When you use DataGridView, you can customize the appearance of individual cells, lock arbitrary rows and columns in place, and display complex controls inside cells, among other features.

Connecting to data sources over a network is a simple task with Windows Forms. The BindingSource component represents a connection to a data source, and exposes methods for binding data to controls, navigating to the previous and next records, editing records, and saving changes back to the original source. The BindingNavigator control provides a simple interface over the BindingSource component for users to navigate between records.

You can create data-bound controls easily by using the Data Sources window in Visual Studio. The window displays data sources such as databases, web services, and objects in your project. You can create data-bound controls by dragging items from this window onto forms in your project. You can also data-bind existing controls to data by dragging objects from the Data Sources window onto existing controls.

Another type of data binding you can manage in Windows Forms is settings. Most apps must retain some information about their run-time state, such as the last-known size of forms, and retain user preference data, such as default locations for saved files. The Application Settings feature addresses these requirements by providing an easy way to store both types of settings on the client computer. After you define these settings by using either Visual Studio or a code editor, the settings are persisted as XML and automatically read back into memory at run time.

Deploy apps to client computers

After you have written your app, you must send the app to your users so that they can install and run it on their own client computers. When you use the ClickOnce technology, you can deploy your apps from within Visual Studio by using just a few clicks, and provide your users with a URL pointing to your app on the web. ClickOnce manages all the elements and dependencies in your app, and ensures that the app is correctly installed on the client computer.

(Video) Windows Form App (.Net Framework)

ClickOnce apps can be configured to run only when the user is connected to the network, or to run both online and offline. When you specify that an app should support offline operation, ClickOnce adds a link to your app in the user's Start menu. The user can then open the app without using the URL.

When you update your app, you publish a new deployment manifest and a new copy of your app to your web server. ClickOnce will detect that there is an update available and upgrade the user's installation. No custom programming is required to update old apps.

See also

  • Tutorial: Create a new WinForms app
  • How to add a form to a project
  • Add a control


What is .NET window forms? ›

Windows Forms is a UI framework for building Windows desktop apps. It provides one of the most productive ways to create desktop apps based on the visual designer provided in Visual Studio. Functionality such as drag-and-drop placement of visual controls makes it easy to build desktop apps.

What is difference between Windows Forms application and Windows Forms .NET framework? ›

Net Framework) if you want to run the application that targets the . Net Framework that is automatically installed when you install the windows on the system. On the other hand, if you want to develop the desktop application with Just Winform app it's mean you are targeting the latest version of .

How to create .NET window form in .NET example? ›

Visual Studio opens your new project.
  1. Open Visual Studio.
  2. On the start window, select Create a new project.
  3. On the Create a new project window, select the Windows Forms App (. NET Framework) template for C#. ...
  4. In the Configure your new project window, type or enter HelloWorld in the Project name box. Then, select Create.
Jan 25, 2023

What is Windows form controls in C#? ›

Windows Forms controls are reusable components that encapsulate user interface functionality and are used in client-side, Windows-based applications. Not only does Windows Forms provide many ready-to-use controls, it also provides the infrastructure for developing your own controls.

Where is system Windows Forms? ›

Forms. Integration namespace is defined in 'WindowsFormsIntegration. dll' which currently ships in the WinFX SDK, not in the standard redist. Therefore, the file will be found in '\Program Files\Reference Assemblies\Microsoft\Framework\v3.

How do I use system Windows Forms in .NET core? ›

NET Core 3.1:
  1. right-mouse click on the project and select Unload Project.
  2. right-mouse click on the project and select "Edit foobar. csproj"
  3. Example of using WPF and Winforms in . NET Core 3.1: where I added the UseWPF and UseWindowsForms tags. Also I changed Microsoft. NET. Sdk to Microsoft. NET. Sdk.

Why use WinForms? ›

WinForms enables a developer to drag and drop controls onto a Windows Form and modify these components using code written in C#, VB.NET, or any other . NET language. Since WinForms is a wrapper for a collection of C++ classes, each WinForms control is an instance of that class.

What is the replacement for WinForms? ›

In fact, even the team at Microsoft created an alternative to WinForms based on the . NET Framework called WPF (Windows Presentation Foundation).

Do I need Windows NET Framework? ›

NET Framework is required to run many applications on Windows. The instructions in this article should help you install the . NET Framework versions that you need.

How do I create a .NET form? ›

Create a New Web Form

To add a new web form in our existing project, first select project then right click and add new item. Select web forms option in left corner and then select web form and hit add button. Now click on the add button and this form will add to our project.

How do I create a Windows form database? ›

Create the sample database by following these steps:
  1. In Visual Studio, open the Server Explorer window.
  2. Right-click on Data Connections and choose Create New SQL Server Database.
  3. In the Server name text box, enter (localdb)\mssqllocaldb.
  4. In the New database name text box, enter Sales, then choose OK.
Oct 7, 2022

How do I create a simple .NET application? ›

On the start page, choose Create a new project. On the Create a new project page, enter console in the search box. Next, choose C# or Visual Basic from the language list, and then choose All platforms from the platform list. Choose the Console Application template, and then choose Next.

How do I close Winforms in C#? ›

Form. Close() is one method in closing a winform. When 'Form. Close()' execute , all resources created in that form are destroyed.

What is the basic use of form control? ›

In addition, online forms contain controls. Controls are objects that display data or make it easier for users to enter or edit data, perform an action, or make a selection. In general, controls make the form easier to use. Examples of common controls include list boxes, option buttons, and command buttons.

What are the different form controls? ›

HTML Form Controls
  • Text Input Controls.
  • Checkboxes Controls.
  • Radio Box Controls.
  • Select Box Controls.
  • File Select boxes.
  • Hidden Controls.
  • Clickable Buttons.
  • Submit and Reset Button.

How do I connect Windows Forms? ›

  1. In Visual Studio select "File" -> "New" -> "Project..." then select C# Windows Forms Application then click Ok. ...
  2. Drag and drop a Label and a TextBox from the Toolbox. ...
  3. Add another Windows Forms form using Project --> Add Windows Form then click on Add. ...
  4. Drag and Drop 3 Labels from the Toolbox onto Form2.
May 21, 2020

How do I deploy a Windows Form? ›

Publish Wizard Deployment of a Windows Forms Application
  1. Right-click the MySolution. ...
  2. Click the Options button located in the Publish tab. ...
  3. Right-click the MySolution. ...
  4. In the invoked Publish Wizard, specify the shared folder as the publishing location and click Next.
Mar 14, 2021

How do I host a Windows Form application? ›

Hosting the Windows Forms Control
  1. Create a WPF Application project named HostingWfInWpf .
  2. Add references to the following assemblies. ...
  3. Open MainWindow. ...
  4. Name the Grid element grid1 . ...
  5. In Design view or XAML view, select the Window element.
  6. In the Properties window, click the Events tab.
  7. Double-click the Loaded event.
Mar 17, 2022

How do I create a .NET Core application? ›

How to create an app for multiple operating systems
  1. In Visual Studio, click File > New Project and select .NET Core. Now select the Console App (.NET Core) project type and create it.
  2. Navigate to Program.cs. Out of the box, it will write Hello World! to the console.
Jan 15, 2018

What is the difference between .NET and .NET framework? ›

Some key differences include: .NET is cross-platform and runs on Linux, macOS, and Windows. . NET Framework only runs on Windows. .NET is open-source and accepts contributions from the community.

Can we create Windows application using .NET Core? ›

NET Core support for building Windows desktop applications, including WPF and Windows Forms. Since then, we have been delighted to see so many developers share their stories of migrating desktop applications (and controls libraries) to . NET Core.

What is the difference between .NET WinForms and WPF? ›

Conclusion. Winforms vs WPF both are mainly used for the same purpose for developing and designing windows applications, but WPF can be used for the web application. The difference between them is scalability, performance as WPF can render fast compared to windows forms, complexity, and support.

What is the difference between Windows Form and user Control Windows Form? ›

User controls are a way of making a custom, reusable component. A user control can contain other controls but must be hosted by a form. Windows forms are the container for controls, including user controls. While it contains many similar attributes as a user control, it's primary purpose is to host controls.

What is .NET used for? ›

.NET is a free, cross-platform, open source developer platform for building many different types of applications. With .NET, you can use multiple languages, editors, and libraries to build for web, mobile, desktop, games, IoT, and more.

How do I know if my computer has .NET Framework? ›

The version of . NET Framework (4.5 and later) installed on a machine is listed in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full. If the Full subkey is missing, then . NET Framework 4.5 or above isn't installed.

What is .NET explained? ›

. NET is an open-source platform for building desktop, web, and mobile applications that can run natively on any operating system. The . NET system includes tools, libraries, and languages that support modern, scalable, and high-performance software development.

How do I create a .NET solution? ›

  1. Build a project and its dependencies: ...
  2. Build a project and its dependencies using Release configuration: ...
  3. Build a project and its dependencies for a specific runtime (in this example, Ubuntu 18.04): ...
  4. Build the project and use the specified NuGet package source during the restore operation:
Jan 24, 2023

How do I connect a SQL database to Windows form? ›

Look at the Windows forms application to learn how to work with Databases.
  1. Step 1: Create a New Project. To get started with C# SQL Server, open Visual Studio to create a new project. ...
  2. Step 2: Connect. Go to the toolbox and add a button to the Windows form. ...
  3. Step 3: Add Event Handler.
Feb 17, 2022

How does Windows Form connect to Access database? ›

How To Connect MS Access With Windows Form
  1. Create a mdb file in MS Access as follows: Open MS Access. Choose Blank Database. Save it as Microsoft Office Access Database (2000) format. ...
  2. Create a table in your database.
  3. Create a Windows form with a button for connectivity.
  4. Import system.Data.OleDb. using System. Data. OleDb;
Jun 28, 2018

How to display data in Windows forms in C#? ›

Step 1: Make a database with a table in SQL Server. Step 2: Create a Windows Application and add DataGridView on the Form. Now add a DataGridView control to the form by selecting it from Toolbox and set properties according to your needs.

Is .NET a programming language? ›

. NET (pronounced dot net) is a framework that provides a programming guidelines that can be used to develop a wide range of applications–––from web to mobile to Windows-based applications. The . NET framework can work with several programming languages such as C#, VB.NET, C++ and F#.

What is NET for beginners? ›

NET is a free, open-source computer software framework for building many different types of applications for Windows, Linux, and macOS operating systems. It enables developers to use a variety of programming languages, editors, and libraries to develop for the web, desktop, mobile, games, and the Internet of Things.

Is it difficult to learn C#? ›

C# is one of the easiest programming languages to learn. C# is a high-level, general-purpose programming language that is easy to read because of its well-defined class hierarchy. It is the perfect language for beginner developers as it will be straightforward to grasp compared to most other languages.

How do I use WinForms in Visual Studio? ›

Create your Windows Forms project
  1. Open Visual Studio.
  2. On the start window, select Create a new project.
  3. On the Create a new project window, search for Windows Forms. ...
  4. Select the Windows Forms App (. ...
  5. In the Configure your new project window, name your project PictureViewer, then select Create.
Sep 1, 2022

How to connect two forms in C#? ›

Form2 newForm= new Form2(); newForm. Show(); this. Hide();

Is WinForms front end? ›

Back-end refers to stuff going on behind the scenes, i.e. not directly visible by the user, and front-end refers to the opposite - the stuff that's directly visible. Hence, WinForms is clearly a front-end thing.

How to collect data from HTML form? ›

The method attribute specifies how to send form-data (the form-data is sent to the page specified in the action attribute). The form-data can be sent as URL variables (with method="get" ) or as HTTP post transaction (with method="post" ). Notes on GET: Appends form-data into the URL in name/value pairs.

What is the difference between form controls and ActiveX controls in Excel? ›

As Hans Passant said, Form controls are built in to Excel whereas ActiveX controls are loaded separately. Generally you'll use Forms controls, they're simpler. ActiveX controls allow for more flexible design and should be used when the job just can't be done with a basic Forms control.

How do you create a form in HTML? ›

To create an HTML form, we will use the HTML <form> element. It starts with the <form> tag and ends with the </form> tag. We can add the input elements within the form tags for taking user input. form elements, such as text box, textarea, etc.

How to insert a image in HTML? ›

The HTML <img> tag is used to embed an image in a web page. Images are not technically inserted into a web page; images are linked to web pages. The <img> tag creates a holding space for the referenced image. The <img> tag is empty, it contains attributes only, and does not have a closing tag.

How do you add a link to a form in HTML? ›

Chapter Summary
  1. Use the <a> element to define a link.
  2. Use the href attribute to define the link address.
  3. Use the target attribute to define where to open the linked document.
  4. Use the <img> element (inside <a> ) to use an image as a link.

How do I secure a form in HTML? ›

Handling HTML form security
  1. Use proper tags.
  2. Use multi-level validation.
  3. Use CSRF token.
  4. Use Captcha.
  5. Validate logic.
  6. Additional form security.
Sep 29, 2021

What's the difference between WPF and Windows forms? ›

Windows forms are mainly based on a pixel, whereas WPF is not pixel-based, which allows the scalability of the UI part for the application. Windows forms support data binding in a limited way, whereas WPF is fully supported data binding. Windows forms are not used with different themes or skins.

What is the difference between WinForms and WPF? ›

WPF can be used to develop and design both Windows applications and web applications while WinForms can only be used to develop and design Windows applications. XAML (Extensible Application Markup Language) is used by WPF to define the user interface of a WPF application.

Is Windows Forms still used? ›

As we mentioned above, WinForms is still available but the status of “maintenance mode” likely means it has no long term future. As time passed by, especially in the last 5-10 years, new tools continued to mature and rise in popularity, and each one of them offered many powerful features.

What is WPF in C# with example? ›

WPF, or Windows Presentation Foundation, is a UI (user interface) framework that creates desktop client applications. The WPF development platform supports a broad set of application development features, including an application model, resources, controls, graphics, layout, data binding, documents, and security.

What is the difference between .net and .NET framework? ›

Some key differences include: .NET is cross-platform and runs on Linux, macOS, and Windows. . NET Framework only runs on Windows. .NET is open-source and accepts contributions from the community.

Is Windows form a GUI? ›

Windows Forms (WinForms) is a free and open-source graphical (GUI) class library included as a part of Microsoft . NET, . NET Framework or Mono, providing a platform to write client applications for desktop, laptop, and tablet PCs.

What can I use instead of Windows Forms? ›

Microsoft Forms Alternatives: The Top 10 in 2023
  • SurveySparrow.
  • JotForm.
  • SurveyMonkey.
  • SoGoSurvey.
  • Typeform.
  • Google Forms.
  • Paperform.
  • Formsite.
Jan 3, 2023

Is it worth to learn WinForms? ›

Compared to WPF, WinForms has much better design-time experience in Visual Studio. This itself is enough to choose WinForms. This is my experience with WinForms and WPF. However, you can choose the appropriate technology as per your requirements.

What is replacing WPF? ›

Alternatives to WPF include: Platform Uno. Avalonia. Blazor.

How old is WinForms? ›

Here's how Microsoft describes it for you coders who might have been more concerned about learning your ABCs when it was introduced in 2002: Windows Forms (WinForms) is a UI framework for building Windows desktop applications.

What are Windows used for? ›

A window is an opening in a wall, door, roof, or vehicle that allows the exchange of light and may also allow the passage of sound and sometimes air.

Which language is used in WPF? ›

Most WPF apps consist of both XAML markup and code-behind. Within a project, the XAML is written as a . xaml file, and a CLR language such as Microsoft Visual Basic or C# is used to write a code-behind file.

What framework does WPF use? ›

It is a subset of the . NET Framework, so if you have previously built applications with the . NET Framework using ASP.NET or Windows Forms, the programming experience should be familiar. WPF uses the Extensible Application Markup Language (XAML) to provide a declarative model for application programming.


1. Create Windows Forms (WinForm) Application using .NET Core
(Timothy Liu)
2. C# Your First Windows Forms Application
(Programming w/ Professor Sluiter)
3. C# Compare Windows Forms vs WPF vs UWP
(Programming w/ Professor Sluiter)
4. Visual Studio 2022 for .NET WinForms developers
(Microsoft Visual Studio)
5. How to add a reference to the System.Windows.Forms lib from a .NET Core WPF project
(Kareem Sulthan)
6. Create your first WinForms app on .NET Core | WinForms with .NET Core Part-1
(Biswa Ranjan)
Top Articles
Latest Posts
Article information

Author: Lilliana Bartoletti

Last Updated: 02/27/2023

Views: 6236

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Lilliana Bartoletti

Birthday: 1999-11-18

Address: 58866 Tricia Spurs, North Melvinberg, HI 91346-3774

Phone: +50616620367928

Job: Real-Estate Liaison

Hobby: Graffiti, Astronomy, Handball, Magic, Origami, Fashion, Foreign language learning

Introduction: My name is Lilliana Bartoletti, I am a adventurous, pleasant, shiny, beautiful, handsome, zealous, tasty person who loves writing and wants to share my knowledge and understanding with you.