Export (0) Print
Expand All

Binding.PropertyName Property

Gets or sets the name of the control's data-bound property.

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

public string PropertyName { get; }

Property Value

Type: System.String
The name of a control property to bind to.

Use the PropertyName to specify the control property that you want to bind to a list in a data source. Most commonly, you bind a display property such as the Text property of a TextBox control. However, because you can bind any property of a control, you can programmatically create controls at run time using data from a database.

The following code example prints the PropertyName value of each Binding for each control on a form.

private void PrintPropertyNameAndIsBinding()
   foreach(Control thisControl in this.Controls)
      foreach(Binding thisBinding in thisControl.DataBindings)
         Console.WriteLine("\n" + thisControl.ToString());
         // Print the PropertyName value for each binding.

.NET Framework

Supported in: 4.5.3, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft