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:
property String^ PropertyName {
	String^ 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()
   {
      for each ( Control^ thisControl in this->Controls)
      {
         for each ( Binding^ thisBinding in thisControl->DataBindings )
         {
            Console::WriteLine( "\n {0}", thisControl );
            // Print the PropertyName value for each binding.
            Console::WriteLine( thisBinding->PropertyName );
         }
      }
   }

.NET Framework
Available since 1.1
Return to top
Show: