다음을 통해 공유


Binding.Control 속성

정의

바인딩이 속한 컨트롤을 가져옵니다.

public:
 property System::Windows::Forms::Control ^ Control { System::Windows::Forms::Control ^ get(); };
public System.Windows.Forms.Control Control { get; }
member this.Control : System.Windows.Forms.Control
Public ReadOnly Property Control As Control

속성 값

Control

바인딩이 속한 Control입니다.

예제

다음 코드 예제에서는 특정 데이터 원본에 대 한 가져오 BindingManagerBase 고 데이터 원본에 바인딩된 각 Control 속성에 대 한 정보를 인쇄 합니다. 이 예제에서는 모든 컨트롤을 가져오기 위해 해당 BindingManagerBase 속성을 사용합니다Bindings.

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.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());
   }
}
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

적용 대상