---
description: A windows form application is any application, which is designed to run on a computer. it becomes a web application. Visual Studio and C# are used to create either Windows Forms or Web-based applications. we use following controls Group Box, Label, Textbox, Listbox, RadioButton, Checkbox, Button
title: C# Windows Forms Application Tutorial with Example
image: https://www.guru99.com/images/csharp-windows-forms-application-tutorial.png
---

 

[Skip to content](#main) 

**⚡ Smart Summary**

C# Windows Forms Application Tutorial introduces building desktop apps with Visual Studio and the .NET framework. Lessons cover the Hello World form, controls, event handling, advanced widgets like TreeView and PictureBox, and design tips for productive WinForms development.

* 🖥️ **Desktop UI Foundation:** Windows Forms is the .NET framework for building drag-and-drop, event-driven desktop GUIs on Windows.
* 🧱 **Core Controls:** TextBox, Label, Button, ListBox, ComboBox, RadioButton, and CheckBox form the building blocks of every WinForms screen.
* ⚡ **Event-Driven Model:** Hook up Click, TextChanged, and Load events through the designer or code to make controls respond to users.
* 🌳 **TreeView and PictureBox:** TreeView models hierarchical data, while PictureBox displays graphics and supports modes like StretchImage and Zoom.
* 🎨 **Designer Productivity:** Visual Studio’s drag-and-drop designer, property grid, and event tab speed up UI building without manual coordinate math.
* 🤖 **AI Assistance:** AI coding tools such as GitHub Copilot and IntelliCode generate event handlers, suggest control layouts, and modernize legacy WinForms code.

[ Read More ](javascript:void%280%29;) 

![C# Windows Forms Application Tutorial](https://www.guru99.com/images/csharp-windows-forms-application-tutorial.png)

So far we have seen how to work with C# to create console based applications. But in a real-life scenario team normally use Visual Studio and C# to create either Windows Forms or Web-based applications.

A windows form application is an application, which is designed to run on a computer. It will not run on web browser because then it becomes a web application.

This Tutorial will focus on how we can create Windows-based applications. We will also learn some basics on how to work with the various elements of C# Windows application.

## Windows Forms Basics

A Windows forms application is one that runs on the desktop computer. A Windows forms application will normally have a collection of controls such as labels, textboxes, list boxes, etc.

Below is an example of a simple Windows form application C#. It shows a simple Login screen, which is accessible by the user. The user will enter the required credentials and then will click the Login button to proceed.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor1.png)

So an example of the controls available in the above application

1. This is a collection of label controls which are normally used to describe adjacent controls. So in our case, we have 2 textboxes, and the labels are used to tell the user that one textbox is for entering the user name and the other for the password.
2. The 2 textboxes are used to hold the username and password which will be entered by the user.
3. Finally, we have the button control. The button control will normally have some code attached to perform a certain set of actions. So for example in the above case, we could have the button perform an action of validating the user name and password which is entered by the user.

### RELATED ARTICLES

* [C# Collections Tutorial with Examples ](https://www.guru99.com/c-sharp-collections.html "C# Collections Tutorial with Examples")
* [C# Database Connection: How to Connect SQL Server ](https://www.guru99.com/c-sharp-access-database.html "C# Database Connection: How to Connect SQL Server")
* [C# Enum(Enumeration) with Example ](https://www.guru99.com/c-sharp-enum.html "C# Enum(Enumeration) with Example")
* [C# Hashtable with Examples ](https://www.guru99.com/c-sharp-hashtable.html "C# Hashtable with Examples")

## C# Hello World

Now let’s look at an example of how we can implement a simple ‘hello world’ application in Visual Studio. For this, we would need to implement the below-mentioned steps

**Step 1)** The first step involves the creation of a new project in Visual Studio. After launching [Visual Studio](https://www.guru99.com/download-install-visual-studio.html), you need to choose the menu option New->Project.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor2.png)

**Step 2)** The next step is to choose the project type as a Windows Forms application. Here we also need to mention the name and location of our project.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor3.png)

1. In the project dialog box, we can see various options for creating different types of projects in Visual Studio. Click the Windows option on the left-hand side.
2. When we click the Windows options in the previous step, we will be able to see an option for Windows Forms Application. Click this option.
3. We will give a name for the application. In our case, it is DemoApplication. We will also provide a location to store our application.
4. Finally, we click the ‘OK’ button to let Visual Studio create our project.

If the above steps are followed, you will get the below output in Visual Studio.

**Output:-**

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor4.png)

You will see a Form Designer displayed in Visual Studio. It’s in this Form Designer that you will start building your Windows Forms application.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor5.png)

In the Solution Explorer, you will also be able to see the DemoApplication Solution. This solution will contain the below 2 project files

1. A Form application called Forms1.cs. This file will contain all of the code for the Windows Form application.
2. The Main program called Program.cs is default code file which is created when a new application is created in Visual Studio. This code will contain the startup code for the application as a whole.

On the left-hand side of Visual Studio, you will also see a ToolBox. The toolbox contains all the controls which can be added to a Windows Forms. Controls like a text box or a label are just some of the controls which can be added to a Windows Forms.

Below is a screenshot of how the Toolbox looks like.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor6.png)

**Step 3)** In this step, we will now add a label to the Form which will display “Hello World.” From the toolbox, you will need to choose the Label control and simply drag it onto the Form.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor7.png)

Once you drag the label to the form, you can see the label embedded on the form as shown below.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor8.png)

**Step 4)** The next step is to go to the properties of the control and Change the text to ‘Hello World’.

To go to the properties of a control, you need to right-click the control and choose the Properties menu option

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor9.png)

* The properties panel also shows up in Visual Studio. So for the label control, in the properties control, go to the Text section and enter “Hello World”.
* Each Control has a set of properties which describe the control.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor10.png)

If you follow all of the above steps and run your program in Visual Studio, you will get the following output

**Output:-**

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor11.png)

In the output, you can see that the Windows Form is displayed. You can also see ‘Hello World’ is displayed on the form.

## Adding Controls to a form

We had already seen how to add a control to a form when we added the label control in the earlier section to display “Hello World.”

Let’s look at the other controls available for Windows forms and see some of their common properties.

In our Windows form application in C# examples, we will create one form which will have the following functionality.

1. The ability for the user to enter name and address.
2. An option to choose the city in which the user resides in
3. The ability for the user to enter an option for the gender.
4. An option to choose a course which the user wants to learn. There will make choices for both C# and ASP.Net

So let’s look at each control in detail and add them to build the form with the above-mentioned functionality.

### Group Box

A group box is used for logical grouping controls into a section. Let’s take an example if you had a collection of controls for entering details such as name and address of a person. Ideally, these are details of a person, so you would want to have these details in a separate section on the Form. For this purpose, you can have a group box. Let’s see how we can implement this with an example shown below

**Step 1)** The first step is to drag the Groupbox control onto the Windows Form from the toolbox as shown below

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor12.png)

**Step 2)** Once the groupbox has been added, go to the properties window by clicking on the groupbox control. In the properties window, go to the Text property and change it to “User Details”.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor13.png)

Once you make the above changes, you will see the following output

**Output:-**

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor14.png)

In the output, you can clearly see that the Groupbox was added to the form. You can also see that the text of the groupbox was changed to “User Details.”

### Label Control

Next comes the Label Control. The label control is used to display a text or a message to the user on the form. The label control is normally used along with other controls. Common examples are wherein a label is added along with the textbox control.

The label indicates to the user on what is expected to fill up in the textbox. Let’s see how we can implement this with an example shown below. We will add 2 labels, one which will be called ‘name’ and the other called ‘address.’ They will be used in conjunction with the textbox controls which will be added in the later section.

**Step 1)** The first step is to drag the label control on to the Windows Form from the toolbox as shown below. Make sure you drag the label control 2 times so that you can have one for the ‘name’ and the other for the ‘address’.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor15.png)

**Step 2)** Once the label has been added, go to the properties window by clicking on the label control. In the properties window, go to the Text property of each label control.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor16.png)

Once you make the above changes, you will see the following output

**Output:-**

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor17.png)

You can see the label controls added to the form.

### Textbox

A textbox is used for allowing a user to enter some text on the Windows application in C#. Let’s see how we can implement this with an example shown below. We will add 2 textboxes to the form, one for the Name and the other for the address to be entered for the user

**Step 1)** The first step is to drag the textbox control onto the Windows Form from the toolbox as shown below

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor18.png)

**Step 2)** Once the text boxes have been added, go to the properties window by clicking on the textbox control. In the properties window, go to the Name property and add a meaningful name to each textbox. For example, name the textbox for the user as txtName and that for the address as txtAddress. A naming convention and standard should be made for controls because it becomes easier to add extra functionality to these controls, which we will see later on.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor19.png)

Once you make the above changes, you will see the following output

**Output:-**

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor20.png)

In the output, you can clearly see that the Textboxes was added to the form.

### List box

A Listbox is used to showcase a list of items on the Windows form. Let’s see how we can implement this with an example shown below. We will add a list box to the form to store some city locations.

**Step 1)** The first step is to drag the list box control onto the Windows Form from the toolbox as shown below

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor21.png)

**Step 2)** Once the list box has been added, go to the properties window by clicking on the list box control.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor22.png)

1. First, change the property of the Listbox box control, in our case, we have changed this to lstCity
2. Click on the Items property. This will allow you to add different items which can show up in the list box. In our case, we have selected items “collection”.
3. In the String Collection Editor, which pops up, enter the city names. In our case, we have entered “Mumbai”, “Bangalore” and “Hyderabad”.
4. Finally, click on the ‘OK’ button.

Once you make the above changes, you will see the following output

**Output:-**

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor23.png)

In the output, you can see that the Listbox was added to the form. You can also see that the list box has been populated with the city values.

### RadioButton

A Radiobutton is used to showcase a list of items out of which the user can choose one. Let’s see how we can implement this with an example shown below. We will add a radio button for a male/female option.

**Step 1)** The first step is to drag the ‘radiobutton’ control onto the Windows Form from the toolbox as shown below.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor24.png)

**Step 2)** Once the Radiobutton has been added, go to the properties window by clicking on the Radiobutton control.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor25.png)

1. First, you need to change the text property of both Radio controls. Go the properties windows and change the text to a male of one radiobutton and the text of the other to female.
2. Similarly, change the name property of both Radio controls. Go the properties windows and change the name to ‘rdMale’ of one radiobutton and to ‘rdfemale’ for the other one.

One you make the above changes, you will see the following output

**Output:-**

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor26.png)

You will see the Radio buttons added to the Windows form.

### Checkbox

A checkbox is used to provide a list of options in which the user can choose multiple choices. Let’s see how we can implement this with an example shown below. We will add 2 checkboxes to our Windows forms. These checkboxes will provide an option to the user on whether they want to learn C# or ASP.Net.

**Step 1)** The first step is to drag the checkbox control onto the Windows Form from the toolbox as shown below

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor27.png)

**Step 2)** Once the checkbox has been added, go to the properties window by clicking on the Checkbox control.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor28.png)

In the properties window,

1. First, you need to change the text property of both checkbox controls. Go the properties windows and change the text to C# and [ASP.Net](https://www.guru99.com/asp-net-tutorial.html).
2. Similarly, change the name property of both Radio controls. Go the properties windows and change the name to chkC of one checkbox and to chkASP for the other one.

Once you make the above changes, you will see the following output

**Output:-**

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor29.png)

### Button

A button is used to allow the user to click on a button which would then start the processing of the form. Let’s see how we can implement this with an example shown below. We will add a simple button called ‘Submit’ which will be used to submit all the information on the form.

**Step 1)** The first step is to drag the button control onto the Windows Form from the toolbox as shown below

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor30.png)

**Step 2)** Once the Button has been added, go to the properties window by clicking on the Button control.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor31.png)

1. First, you need to change the text property of the button control. Go the properties windows and change the text to ‘submit’.
2. Similarly, change the name property of the control. Go the properties windows and change the name to ‘btnSubmit’.

Once you make the above changes, you will see the following output

**Output:-**

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor32.png)

Congrats, you now have your first basic Windows Form in place. Let’s now go to the next topic to see how we can do Event handling for Controls.

## C# Event Handling for Controls

When working with windows form, you can add events to controls. An event is something that happens when an action is performed. Probably the most common action is the clicking of a button on a form. In C# Windows Forms, you can add code which can be used to perform certain actions when a button is pressed on the form.

Normally when a button is pressed on a form, it means that some processing should take place.

Let’s take a look at one of the event and how it can be handled before we go to the button event scenario.

The below example will showcase an event for the Listbox control. So whenever an item is selected in the listbox control, a message box should pop up which shows the item selected. Let’s perform the following steps to achieve this.

**Step 1)** Double click on the Listbox in the form designer**.** By doing this, Visual Studio will automatically open up the code file for the form. And it will automatically add an event method to the code. This event method will be triggered, whenever any item in the listbox is selected.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor33.png)

Above is the snippet of code which is automatically added by Visual Studio, when you double-click the List box control on the form. Now let’s add the below section of code to this snippet of code, to add the required functionality to the listbox event.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor34.png)

1. This is the event handler method which is automatically created by Visual Studio when you double-click the List box control. You don’t need to worry about the complexity of the method name or the parameters passed to the method.
2. Here we are getting the SelectedItem through the lstCity.SelectedItem property. Remember that lstCity is the name of our Listbox control. We then use the GetItemText method to get the actual value of the selected item. We then assign this value to the text variable.
3. Finally, we use the MessageBox method to display the text variable value to the user.

One you make the above changes, and run the program in Visual Studio you will see the following output

**Output:-**

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor35.png)

From the output, you can see that when any item from the list box is selected, a message box will pops up. This will show the selected item from the listbox.

Now let’s look at the final control which is the button click Method. Again this follows the same philosophy. Just double click the button in the Forms Designer and it will automatically add the method for the button event handler. Then you just need to add the below code.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor36.png)

1. This is the event handler method which is automatically created by Visual Studio when you double click the button control. You don’t need to worry on the complexity of the method name or the parameters passed to the method.
2. Here we are getting values entered in the name and address textbox. The values can be taken from the text property of the textbox. We then assign the values to 2 variables, name, and address accordingly.
3. Finally, we use the MessageBox method to display the name and address values to the user.

One you make the above changes, and run the program in Visual Studio you will see the following output

**Output:-**

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor37.png)

1. First, enter a value in the name and address field.
2. Then click on the Submit button

Once you click the Submit button, a message box will pop, and it will correctly show you what you entered in the user details section.

## Tree and PictureBox Control

There are 2 further controls we can look at, one is the ‘Tree Control’ and the other is the ‘Image control’. Let’s look at examples of how we can implement these controls

### Tree Control

– The tree control is used to list down items in a tree like fashion. Probably the best example is when we see the Windows Explorer itself. The folder structure in Windows Explorer is like a tree-like structure.

Let’s see how we can implement this with an example shown below.

**Step 1)** The first step is to drag the Tree control onto the Windows Form from the toolbox as shown below

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor38.png)

**Step 2)** The next step is to start adding nodes to the tree collection so that it can come up in the tree accordingly. First, let’s follow the below sub-steps to add a root node to the tree collection.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor39.png)

1. Go to the properties toolbox for the tree view control. Click on the Node’s property. This will bring up the TreeNode Editor
2. In the TreeNode Editor click on the Add Root button to add a root node to the tree collection.
3. Next, change the text of the Root node and provide the text as Root and click ‘OK’ button. This will add Root node.

**Step 3)** The next step is to start adding the child nodes to the tree collection. Let’s follow the below sub-steps to add child root node to the tree collection.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor40.png)

1. First, click on the Add child button. This will allow you to add child nodes to the Tree collection.
2. For each child node, change the text property. Keep on repeating the previous step and this step and add 2 additional nodes. In the end, you will have 3 nodes as shown above, with the text as Label, Button, and Checkbox respectively.
3. Click on the OK button

Once you have made the above changes, you will see the following output.

**Output:-**

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor41.png)

You will be able to see the Tree view added to the form. When you run the Windows form application, you can expand the root node and see the child nodes in the list.

### PictureBox Control

This control is used to add images to the Winforms C#. Let’s see how we can implement this with an example shown below.

**Step 1)** The first step is to drag the PictureBox control onto the C# Windows Form from the toolbox as shown below

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor42.png)

**Step 2)** The next step is to actually attach an image to the picture box control. This can be done by following the below steps.

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor43.png)

1. First, click on the Image property for the PictureBox control. A new window will pops out.
2. In this window, click on the Import button. This will be used to attach an image to the picturebox control.
3. A dialog box will pop up in which you will be able to choose the image to attach the picturebox
4. Click on the OK button

One you make the above changes, you will see the following output

**Output:-**

[](https://www.guru99.com/images/c-sharp-net/052716%5F0436%5FCWindowsFor44.png)

From the output, you can see that an image is displayed on the form.

## FAQs

⚡ Is Windows Forms still relevant for new C# applications in 2026?

Yes. Microsoft continues supporting WinForms in .NET 8 and newer with high-DPI improvements. It remains popular for line-of-business apps where rapid development and Windows-only deployment are acceptable.

🤖 How can AI accelerate C# Windows Forms development?

AI assistants like GitHub Copilot, Cursor, and JetBrains AI generate event handlers, layout code, and data binding boilerplate. They speed up control wiring and help modernize WinForms applications toward .NET 8.

💡 Can AI tools migrate Windows Forms apps to WPF or MAUI?

Yes. Specialized migration assistants and AI agents help convert WinForms to WPF, WinUI 3, or .NET MAUI. Manual review is still required, but AI reduces the manual repetitive refactoring work significantly.

🆚 What is the difference between Windows Forms and WPF in C#?

WinForms uses GDI-based controls with a designer focused on data-entry apps. WPF uses XAML, hardware-accelerated rendering, MVVM patterns, and modern styling for richer, scalable user interfaces.

🌳 How do I add controls dynamically at runtime in WinForms?

Create the control instance in code, set its properties such as Location and Text, then call this.Controls.Add(control). Hook event handlers afterwards to make the control respond to user actions.

🎨 Can Windows Forms applications support high-DPI displays properly?

Yes. Set the application high-DPI mode to PerMonitorV2 in the app manifest or Program.cs. Use AutoScaleMode.Dpi on forms so controls and fonts scale correctly across modern monitors.

🔒 How do I package and distribute a WinForms application?

Use Visual Studio publish profiles to create a self-contained .NET deployment, MSIX installer, or ClickOnce package. These approaches bundle the runtime and simplify installation across Windows machines.

📚 Which IDE works best for Windows Forms development today?

Visual Studio 2022 and newer offer the most complete WinForms designer experience. JetBrains Rider also supports WinForms with strong refactoring tools, but its designer is less feature complete than Visual Studio.

#### Summarize this post with:

ChatGPT Perplexity Grok Google AI 

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.** 

##### Sign up for the newsletter

Subscribe for Free 

You have successfully subscribed.  
Please check your inbox. 

![AI-Newsletter]() Chosen by over **350,000+** professionals 

[Scroll to top ](#wrapper)Scroll to top 

× 

Toggle Menu Close 

Search for: 

Search

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/csharp-windows-forms-application-tutorial.png","url":"https://www.guru99.com/images/csharp-windows-forms-application-tutorial.png","width":"700","height":"250","caption":"C# Windows Forms Application Tutorial","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/c-sharp-windows-forms-application.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/c","name":"C#"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/c-sharp-windows-forms-application.html","name":"C# Windows Forms Application Tutorial with Example"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/c-sharp-windows-forms-application.html#webpage","url":"https://www.guru99.com/c-sharp-windows-forms-application.html","name":"C# Windows Forms Application Tutorial with Example","dateModified":"2026-06-23T11:58:50+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/csharp-windows-forms-application-tutorial.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/c-sharp-windows-forms-application.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/benjamin","name":"Benjamin Walker","description":"I'm Benjamin Walker, an expert in C, C++, and C# programming, providing resources to enhance your coding proficiency and project outcomes.","url":"https://www.guru99.com/author/benjamin","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/benjamin-walker-author.png","url":"https://www.guru99.com/images/benjamin-walker-author.png","caption":"Benjamin Walker","inLanguage":"en-US"},"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"articleSection":"C#","headline":"C# Windows Forms Application Tutorial with Example","description":"A windows form application is any application, which is designed to run on a computer. it becomes a web application. Visual Studio and C# are used to create either Windows Forms or Web-based applications. we use following controls Group Box, Label, Textbox, Listbox, RadioButton, Checkbox, Button","keywords":"c#","speakable":{"@type":"SpeakableSpecification","cssSelector":[".entry-title",".summary"]},"@type":"Article","author":{"@id":"https://www.guru99.com/author/benjamin","name":"Benjamin Walker"},"dateModified":"2026-06-23T11:58:50+05:30","image":{"@id":"https://www.guru99.com/images/csharp-windows-forms-application-tutorial.png"},"copyrightYear":"2026","name":"C# Windows Forms Application Tutorial with Example","subjectOf":[{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"Is Windows Forms still relevant for new C# applications in 2026?","acceptedAnswer":{"@type":"Answer","text":"Yes. Microsoft continues supporting WinForms in .NET 8 and newer with high-DPI improvements. It remains popular for line-of-business apps where rapid development and Windows-only deployment are acceptable."}},{"@type":"Question","name":"How can AI accelerate C# Windows Forms development?","acceptedAnswer":{"@type":"Answer","text":"AI assistants like GitHub Copilot, Cursor, and JetBrains AI generate event handlers, layout code, and data binding boilerplate. They speed up control wiring and help modernize WinForms applications toward .NET 8."}},{"@type":"Question","name":"Can AI tools migrate Windows Forms apps to WPF or MAUI?","acceptedAnswer":{"@type":"Answer","text":"Yes. Specialized migration assistants and AI agents help convert WinForms to WPF, WinUI 3, or .NET MAUI. Manual review is still required, but AI reduces the manual repetitive refactoring work significantly."}},{"@type":"Question","name":"What is the difference between Windows Forms and WPF in C#?","acceptedAnswer":{"@type":"Answer","text":"WinForms uses GDI-based controls with a designer focused on data-entry apps. WPF uses XAML, hardware-accelerated rendering, MVVM patterns, and modern styling for richer, scalable user interfaces."}},{"@type":"Question","name":"How do I add controls dynamically at runtime in WinForms?","acceptedAnswer":{"@type":"Answer","text":"Create the control instance in code, set its properties such as Location and Text, then call this.Controls.Add(control). Hook event handlers afterwards to make the control respond to user actions."}},{"@type":"Question","name":"Can Windows Forms applications support high-DPI displays properly?","acceptedAnswer":{"@type":"Answer","text":"Yes. Set the application high-DPI mode to PerMonitorV2 in the app manifest or Program.cs. Use AutoScaleMode.Dpi on forms so controls and fonts scale correctly across modern monitors."}},{"@type":"Question","name":"How do I package and distribute a WinForms application?","acceptedAnswer":{"@type":"Answer","text":"Use Visual Studio publish profiles to create a self-contained .NET deployment, MSIX installer, or ClickOnce package. These approaches bundle the runtime and simplify installation across Windows machines."}},{"@type":"Question","name":"Which IDE works best for Windows Forms development today?","acceptedAnswer":{"@type":"Answer","text":"Visual Studio 2022 and newer offer the most complete WinForms designer experience. JetBrains Rider also supports WinForms with strong refactoring tools, but its designer is less feature complete than Visual Studio."}}]}],"@id":"https://www.guru99.com/c-sharp-windows-forms-application.html#schema-1118320","isPartOf":{"@id":"https://www.guru99.com/c-sharp-windows-forms-application.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/c-sharp-windows-forms-application.html#webpage"}}]}
```
