Bind Windows Forms controls to data in Visual Studio


You can display data to users of your application by binding data to Windows Forms. To create these data-bound controls, you can drag items from the Data Sources window onto the Windows Forms Designer in Visual Studio. This topic describes some of the most common tasks, tools, and classes involved in creating data-bound Windows Forms applications.

Data Source drag operation

For general information about how to create data-bound controls in Visual Studio, see Bind controls to data in Visual Studio. For more information about data binding in Windows Forms, see Windows Forms Data Binding.

The BindingSource component serves two purposes. First, it provides a layer of abstraction when binding the controls on your form to data. Controls on the form are bound to the BindingSource component (instead of being bound directly to a data source).

Second, it can manage a collection of objects. Adding a type to the BindingSource creates a list of that type.

For more information about the BindingSource component, see:

This component provides a user interface for navigating through data displayed by a Windows application. For more information, see BindingNavigator Control.

To display and edit tabular data from many different kinds of data sources, use the DataGridView control. You can bind data to a DataGridView by using the DataSource property. For more information, see DataGridView Control Overview.

Bind controls to data in Visual Studio