Retrieves a value indicating whether the specified control is a child of the control.
[Visual Basic]
Public Function Contains( _
ByVal ctl As Control _
) As Boolean
[C#]
public bool Contains(
Control ctl
);
[C++]
public: bool Contains(
Control* ctl
);
[JScript]
public function Contains(
ctl : Control
) : Boolean;
Parameters
- ctl
- The Control to evaluate.
Return Value
true if the specified control is a child of the control; otherwise, false.
Example
[Visual Basic, C#, C++] The following example ensures that a Label is visible by calling its BringToFront method. This example assumes you have a Form with a Panel named panel1, and a Label named label1.
[Visual Basic]
Private Sub MakeLabelVisible()
' If the panel contains label1, bring it
' to the front to make sure it is visible.
If panel1.Contains(label1) Then
label1.BringToFront()
End If
End Sub
[C#]
private void MakeLabelVisible()
{
/* If the panel contains label1, bring it
* to the front to make sure it is visible. */
if(panel1.Contains(label1))
{
label1.BringToFront();
}
}
[C++]
private:
void MakeLabelVisible() {
/* If the panel contains label1, bring it
* to the front to make sure it is visible. */
if (panel1->Contains(label1)) {
label1->BringToFront();
}
}
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
Control Class | Control Members | System.Windows.Forms Namespace | Contains | Controls | Parent