Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataGridViewColumn::DataPropertyName Property

 

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

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public:
[BrowsableAttribute(true)]
[TypeConverterAttribute("System.Windows.Forms.Design.DataMemberFieldConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
property String^ DataPropertyName {
	String^ get();
	void set(String^ value);
}

Property Value

Type: System::String^

The case-insensitive name of the property or database column associated with the DataGridViewColumn.

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.

The following code example shows how to choose what property each column will represent.

No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show:
© 2017 Microsoft