DataPropertyName Property

Gets or sets the name of the data source property or database column to which the Column is bound.

Syntax

Public Property DataPropertyName As String

Applies To

Column Object

Data Type

String

Remarks

When the AutoGenerateColumns property is set to true, each column automatically sets its DataPropertyName property to the name of a property or database column in the data source specified by the DataSource property. This binding can also be performed manually, which is useful when you want to display only a subset of the properties or database columns available in the data source. In such cases, set the AutoGenerateColumns property to false, and then manually add each DataGridViewColumn, setting the value of each DataPropertyName property to the properties or database columns in the data source that you want to display.