# Data Binding

Learn the basics of databinding in C1Input.

## Content

**C1Input** controls can function both in unbound and in bound mode. In bound mode, a control’s [Value](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.Value.html) is bound to a data source field.

**C1Input** controls support data binding to all .NET data sources. This includes ADO.NET data source objects such as DataTable, DataView and DataSet, and also DataObjects components such as C1ExpressTable, C1ExpressView, C1ExpressConnection, C1DataView, C1DataTableSource and C1DataSet.

For details about creating ADO.NET data source objects, please refer to the .NET Framework documentation.

For details about using DataObjects, see the C1DataObjects documentation included in the ComponentOne Studio Enterprise. DataObjects is a data framework, a part of ComponentOne Studio Enterprise, enhancing ADO.NET in many ways.

To bind a C1Input control to a date source field:

1. Assign the data source object to the control's [DataSource](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.DataSource.html) property
2. Then assign a field of the data source object to the control’s [DataField](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.DataField.html) property.
<br>
    You can set the DataSource and DataField properties in code as well as in the designer. At design time, you can select the data source object and its field from the lists of available data sources and their fields provided by the DataSource/DataField property combo boxes.
3. Set the [DataType](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.DataType.html) property.
<br>
    After you bind the control to a data field, the DataType property is automatically set to the data type of the field it is bound to. In most cases, this setting is what you need. However, sometimes you need different types for the control and the field. For example, you might have a string field containing dates. In such cases, you can set the DataType property after binding and use the [BindingFormatting](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.BindingFormatting.html)/[BindingParsing](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.BindingParsing.html) events to convert data to/from the control’s DataType when it is written from/saved to the data source.

The DataSource/DataField properties are used to bind the Value property of the control to a data source field. The Value property is the main property of a **C1Input** control. It holds and returns a value with of a specific data type. In addition, you have the freedom to bind other properties of the control to other data sources and fields, as in any other WinForms control, using the [DataBindings](http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.databindings(vs.80).aspx) property. This functionality is not **C1Input**-specific; it is supported by the .NET Framework for all controls.

>type=warning
> **Caution**: Do not use properties other than the **Value** property under **DataBindings** to bind the control’s value to a field, use the DataSource and DataField properties instead (or use **Value** in **DataBindings**). For example, although it is possible to bind the **Text** property to a field, the result will not be the same as binding the **Value** property.

## See Also

[Value and Text: Displaying, Validating, and Updating Values](/componentone/docs/win/online-input/usingthec1inputcontr/valueandtextdisplayi)