Binding.PropertyName Propriété

Définition

Obtient le nom de la propriété liée aux données du contrôle.

public:
 property System::String ^ PropertyName { System::String ^ get(); };
public string PropertyName { get; }
member this.PropertyName : string
Public ReadOnly Property PropertyName As String

Valeur de propriété

Nom de la propriété du contrôle à lier.

Exemples

L’exemple de code suivant imprime la PropertyName valeur de chacun Binding pour chaque contrôle d’un formulaire.

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 );
         }
      }
   }
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.
         Console.WriteLine(thisBinding.PropertyName);
      }
   }
}
Private Sub PrintPropertyNameAndIsBinding
    Dim thisControl As Control
    Dim thisBinding As Binding
    For Each thisControl In Me.Controls
        For Each thisBinding In thisControl.DataBindings
            Console.WriteLine(ControlChars.CrLf & thisControl.ToString)
            ' Print the PropertyName value for each binding.
            Console.WriteLine(thisBinding.PropertyName)
        Next
    Next
End Sub

Remarques

Utilisez pour PropertyName spécifier la propriété de contrôle que vous souhaitez lier à une liste dans une source de données. Le plus souvent, vous liez une propriété d’affichage telle que la Text propriété d’un TextBox contrôle. Toutefois, comme vous pouvez lier n’importe quelle propriété d’un contrôle, vous pouvez créer des contrôles par programmation au moment de l’exécution à l’aide des données d’une base de données.

S’applique à