Array Collections File String Windows VB.NET Algorithm ASP.NET Cast Class Compression Convert Data Delegate Directive Enum Exception If Interface Keyword LINQ Loop Method .NET Number Regex Sort StringBuilder Struct Switch Time Value

The look and feel of an application impacts its success. The Windows Forms platform enables .NET developers to create native Windows applications. It provides high-quality user experiences. It is used by many businesses and organizations. It is programmed with C# code.
This Windows Forms program uses code written in the C# language to set the properties of a TextBox control on the Load event. When the program executes, the TextBox will show the string "Dot Net Perls" in a large Font style.
Windows Forms program with TextBox [C#]
using System;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.textBox1.Font = new Font("Consolas", 15.0f);
this.textBox1.Text = "Dot Net Perls";
}
}
}
Result
(Example shown in screenshot.)There are many different controls in Windows Forms, and many of these are detailed here. Most of these articles follow the same format, which contains both a walkthrough for common tasks and some descriptions of relevant properties, events and methods.
BackgroundWorker
Button
Chart
CheckBox
CheckedListBox
ComboBox
ContextMenuStrip
DataGridView
DateTimePicker
DomainUpDown
DropDownItems
ErrorProvider
EventLog
FileSystemWatcher
GroupBox
HelpProvider
ImageList
ListBox
ListView
MenuStrip
MonthCalendar
NotifyIcon
NumericUpDown
PictureBox
Pointer
ProgressBar
PropertyGrid
RadioButton
SplitContainer
StatusStrip
TabControl
ToolStripContainer
ToolTip
TrackBar
TreeView
WebBrowserPanel controls. With panels in Windows Forms, you can easily arrange sub-controls in your form. Controls can then be positioned automatically as the window resizes, making for a better user experience.
FlowLayoutPanel Panel TableLayoutPanelTextBox information. Several tutorials here cover how you can use text box controls in your Windows Forms programs. The controls differ in important ways.
MaskedTextBox RichTextBox TextBoxDialog examples. A dialog is a window that must be dismissed before further action can be taken by the user. There are several examples on dialog boxes.
ColorDialog DialogResult FolderBrowserDialog FontDialog OpenFileDialog SaveFileDialogLabel controls. You can also use Label controls to insert text or other elements into your Windows Forms programs.
Label LinkLabel
Windows Forms provides the useful DataGridView control, which allows you to display structured data from memory or from any database in an automated way. In Windows Forms, you do not need to develop your own grid logic, but can simply plug in your data to the DataGridView. That said, the DataGridView has many complexities and some help is always needed.
Code that adds column and rows to DataGridView [C#]
private void Form1_Load(object sender, EventArgs e)
{
// One column.
dataGridView1.Columns.Add("Name", "Name");
// Three rows.
var rows = dataGridView1.Rows;
rows.Add("Dot");
rows.Add("Net");
rows.Add("Perls");
}
Result
(Windows Forms program with one column and three rows.)Description. This simple method, which is run when a Windows Forms program begins, adds one column and then three rows based on that column to a DataGridView instance. You will need to use the interface in Visual Studio to set up the DataGridView so this program works.

DataGridView examples. The most popular DataGridView article here—linked to in the Controls section above—focuses on the C# language. It describes ways you can use DataGridView in your Windows Forms program, and also provides example code.
DataGridView Tutorial Convert List to DataTable, Use DataGridViewDataGridView properties. The DataGridView control has many different properties you can adjust. This article contains my notes for the DataGridView and details ways you can use these properties. Some properties are described in more detail as well.
DataGridView Property Notes MultiSelectDataGridView columns. You can specify the columns in your DataGridView using a variety of different approaches. This can be done programmatically or declaratively in Visual Studio. We show how you can use the Edit Columns dialog.
ColumnsRows. There is some information on DataGridView rows and how to change their colors. One really neat effect is to have the row colors alternate. This can make the visual output easier to read. We also cover general aspects of DataGridView rows.
DataGridView Row Colors: Alternating DataGridView Add RowsThe Windows Forms framework relies heavily on base types. All controls are derived from the Control type. All forms you develop are derived from the Form type. This gives you a way to handle objects in a unified, consistent way.
Control Form
There are also many properties you can change on controls and forms in Windows Forms with the C# language and through the Visual Studio designer. We cover aspects of properties in this platform.
Anchor BackColor DataSource Focused ForeColor IntegralHeight Tag Text ToolTip Property Notes
Events. Windows Forms is event driven. You can trigger behaviors in your controls when another action happens, such as when the user clicks the mouse. These articles cover certain events. Many of the other articles here also cover events.
KeyCode PreviewKeyDown TextChanged
Methods. Windows Forms also provide a large selection of useful methods for us to use. We touch on specific methods in some detail. Other tutorials here also describe methods.
InitializeComponent MessageBox.Show TextBox.AppendTextYou can use the LINQ extensions in the C# language to quickly search forms in your Windows Forms program. In this context, we introduce query expressions.
Query Windows Forms Controls
When using Windows Forms, sometimes you cannot use a pre-made or built-in solution to a specific problem. We describe ways you can solve problems using customized solutions, such as new controls or techniques for a specific requirement.
Customized Dialog Box NGEN Installer Class Position Windows Segoe UI, Tahoma in Windows Forms Single-Instance Windows Form Undo Paste ProblemTip: It is easier to use the built-in Windows Forms controls if at all possible.

Even as web-based user interfaces gain prominence in the business world, Windows-based programs hold their place. Among other benefits, these programs do not rely on network connectivity and thus may offer increased security for sensitive data.