Freigeben über


Binding.Control-Eigenschaft

Ruft das Steuerelement ab, zu dem die Bindung gehört.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public ReadOnly Property Control As Control
'Usage
Dim instance As Binding
Dim value As Control

value = instance.Control
public Control Control { get; }
public:
property Control^ Control {
    Control^ get ();
}
/** @property */
public Control get_Control ()
public function get Control () : Control

Eigenschaftenwert

Das Control, zu dem die Bindung gehört.

Beispiel

Im folgenden Codebeispiel wird die BindingManagerBase für eine bestimmte Datenquelle abgerufen, und die Informationen zu jeder an die Datenquelle gebundenen Control-Eigenschaft werden gedruckt. Im Beispiel werden mithilfe der Bindings-Eigenschaft der BindingManagerBase sämtliche Steuerelemente abgerufen.

Private Sub PrintBoundControls1
   ' Gets the BindingManagerBase for the Customers table.
   Dim myBindingBase As BindingManagerBase = _
   Me.BindingContext(ds, "Customers")

   ' Prints the information of each control managed by
   ' the BindingManagerBase.
   Dim b As Binding
   For Each b In myBindingBase.Bindings
      Console.WriteLine(b.Control.ToString)
   Next
End Sub

Private Sub PrintBoundControls2
   ' Gets the BindingManagerBase for a child table of
   ' the Customers table. The RelationName of a DataRelation
   ' is appended to the parent table's name.
   Dim myBindingBase As BindingManagerBase = _
   Me.BindingContext(ds, "Customers.CustToOrders")


   ' Prints the information of each control managed by
   ' the BindingManagerBase.
   Dim b As Binding
   For Each b In myBindingBase.Bindings
      Console.WriteLine(b.Control.ToString)
   Next
End Sub
private void PrintBoundControls1()
{
   // Get the BindingManagerBase for the Customers table.
   BindingManagerBase myBindingBase = 
      this.BindingContext[ds, "Customers"];

   /* Print the information of each control managed by
      the BindingManagerBase. */
   foreach(Binding b in myBindingBase.Bindings)
   {
      Console.WriteLine(b.Control.ToString());
   }
}

private void PrintBoundControls2()
{
   /* Get the BindingManagerBase for a child table of
   the Customers table. The RelationName of a DataRelation
   is appended to the parent table's name. */
   BindingManagerBase myBindingBase = 
      this.BindingContext[ds, "Customers.CustToOrders"];

   /* Print the information of each control managed by
      the BindingManagerBase. */
   foreach(Binding b in myBindingBase.Bindings)
   {
      Console.WriteLine(b.Control.ToString());
   }
}
void PrintBoundControls1()
{
   
   // Get the BindingManagerBase for the Customers table.
   BindingManagerBase^ myBindingBase = this->BindingContext[ ds,"Customers" ];
   
   /* Print the information of each control managed by
         the BindingManagerBase. */
   System::Collections::IEnumerator^ myEnum = myBindingBase->Bindings->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      Binding^ b = safe_cast<Binding^>(myEnum->Current);
      Console::WriteLine( b->Control );
   }
}

void PrintBoundControls2()
{
   
   /* Get the BindingManagerBase for a child table of
         the Customers table. The RelationName of a DataRelation
         is appended to the parent table's name. */
   BindingManagerBase^ myBindingBase = this->BindingContext[ ds,"Customers::CustToOrders" ];
   
   /* Print the information of each control managed by
         the BindingManagerBase. */
   System::Collections::IEnumerator^ myEnum = myBindingBase->Bindings->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      Binding^ b = safe_cast<Binding^>(myEnum->Current);
      Console::WriteLine( b->Control );
   }
}
private void PrintBoundControls1()
{
    // Get the BindingManagerBase for the Customers table.
    BindingManagerBase myBindingBase = 
        this.get_BindingContext().get_Item(ds, "Customers");

    /* Print the information of each control managed by
       the BindingManagerBase. 
     */
    for (int iCtr = 0; iCtr < myBindingBase.get_Bindings().get_Count(); 
        iCtr++) {
        Binding b = myBindingBase.get_Bindings().get_Item(iCtr);
        Console.WriteLine(b.get_Control().ToString());
    }
} //PrintBoundControls1

private void PrintBoundControls2()
{
    /* Get the BindingManagerBase for a child table of
       the Customers table. The RelationName of a DataRelation
       is appended to the parent table's name. 
     */
    BindingManagerBase myBindingBase = 
        this.get_BindingContext().get_Item(ds, "Customers.CustToOrders");
    /* Print the information of each control managed by
       the BindingManagerBase. 
     */
    for (int iCtr = 0; iCtr < myBindingBase.get_Bindings().get_Count();
        iCtr++) {
        Binding b = myBindingBase.get_Bindings().get_Item(iCtr);
        Console.WriteLine(b.get_Control().ToString());
    }
} //PrintBoundControls2
private function PrintBoundControls1()
{
   // Get the BindingManagerBase for the Customers table.
   var myBindingBase : BindingManagerBase = 
      this.BindingContext[ds, "Customers"];

   /* Print the information of each control managed by
      the BindingManagerBase. */
   for(var b : Binding in myBindingBase.Bindings)
   {
      Console.WriteLine(b.Control.ToString());
   }
}

private function PrintBoundControls2()
{
   /* Get the BindingManagerBase for a child table of
   the Customers table. The RelationName of a DataRelation
   is appended to the parent table's name. */
   var myBindingBase : BindingManagerBase  = 
      this.BindingContext[ds, "Customers.CustToOrders"];

   /* Print the information of each control managed by
      the BindingManagerBase. */
   for(var b : Binding in myBindingBase.Bindings)
   {
      Console.WriteLine(b.Control.ToString());
   }
}

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

Binding-Klasse
Binding-Member
System.Windows.Forms-Namespace