Obtiene la ventana MDI (interfaz de múltiples documentos) secundaria activa actual.
Espacio de nombres: System.Windows.Forms
Ensamblado: System.Windows.Forms (en system.windows.forms.dll)
Visual Basic (Declaración)
Public ReadOnly Property ActiveMdiChild As Form
Dim instance As Form
Dim value As Form
value = instance.ActiveMdiChild
public Form ActiveMdiChild { get; }
public:
property Form^ ActiveMdiChild {
Form^ get ();
}
/** @property */
public Form get_ActiveMdiChild ()
public function get ActiveMdiChild () : Form
Valor de propiedad
Devuelve un Form que representa la ventana MDI (interfaz de múltiples documentos) secundaria activa actual o referencia null (Nothing en Visual Basic) si no hay actualmente ninguna ventana secundaria.
Este método se puede usar para determinar si hay muchos formularios MDI secundarios abiertos en la aplicación MDI. También se puede usar este método para realizar operaciones en una ventana MDI secundaria desde su formulario MDI principal o desde otro formulario mostrado en la aplicación.
Si el formulario activo actual no es un formulario MDI secundario, se puede usar la propiedad ActiveForm para obtener una referencia a dicho formulario.
En el ejemplo de código siguiente se obtiene una referencia al formulario MDI secundario activo y se recorren todos los controles TextBox del formulario, restableciendo sus propiedades Text. En este ejemplo se requiere que se haya creado un formulario MDI principal y que la llamada a este método se realice desde dicho formulario.
Public Sub ClearAllChildFormText()
' Obtain a reference to the currently active MDI child form.
Dim tempChild As Form = Me.ActiveMdiChild
' Loop through all controls on the child form.
Dim i As Integer
For i = 0 To tempChild.Controls.Count - 1
' Determine if the current control on the child form is a TextBox.
If TypeOf tempChild.Controls(i) Is TextBox Then
' Clear the contents of the control since it is a TextBox.
tempChild.Controls(i).Text = ""
End If
Next i
End Sub 'ClearAllChildFormText
public void ClearAllChildFormText()
{
// Obtain a reference to the currently active MDI child form.
Form tempChild = this.ActiveMdiChild;
// Loop through all controls on the child form.
for (int i = 0; i < tempChild.Controls.Count; i++)
{
// Determine if the current control on the child form is a TextBox.
if (tempChild.Controls[i] is TextBox)
{
// Clear the contents of the control since it is a TextBox.
tempChild.Controls[i].Text = "";
}
}
}
public:
void ClearAllChildFormText()
{
// Obtain a reference to the currently active MDI child form.
Form^ tempChild = this->ActiveMdiChild;
// Loop through all controls on the child form.
for ( int i = 0; i < tempChild->Controls->Count; i++ )
{
// Determine if the current control on the child form is a TextBox.
if ( dynamic_cast<TextBox^>(tempChild->Controls[ i ]) )
{
// Clear the contents of the control since it is a TextBox.
tempChild->Controls[ i ]->Text = "";
}
}
}
public void ClearAllChildFormText()
{
// Obtain a reference to the currently active MDI child form.
Form tempChild = this.get_ActiveMdiChild();
// Loop through all controls on the child form.
for (int i = 0; i < tempChild.get_Controls().get_Count(); i++) {
// Determine if the current control on the child form is a
// TextBox.
if (tempChild.get_Controls().get_Item(i) instanceof TextBox) {
// Clear the contents of the control since it is a TextBox.
tempChild.get_Controls().get_Item(i).set_Text("");
}
}
} //ClearAllChildFormText
Windows 98, Windows 2000 Service Pack 4, Windows CE, Windows Millennium, Windows Mobile para Pocket PC, Windows Mobile para Smartphone, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter
Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.
.NET Framework
Compatible con: 3.0, 2.0, 1.1, 1.0