PropertyName Property

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
Available since 1.1
Return to top
© 2016 Microsoft