Binding.Control Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the control that the binding belongs to.
public:
property System::Windows::Forms::Control ^ Control { System::Windows::Forms::Control ^ get(); };
public System.Windows.Forms.Control Control { get; }
public System.Windows.Forms.Control? Control { get; }
member this.Control : System.Windows.Forms.Control
Public ReadOnly Property Control As Control
Property Value
The Control that the binding belongs to.
Examples
The following code example gets the BindingManagerBase for a specific data source, and prints information about each Control property that is bound to the data source. The example uses the Bindings property of the BindingManagerBase to get all controls.
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
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET