Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/05/2007, 04:16
Avatar de freegirl
freegirl
Colaborador
 
Fecha de Ingreso: octubre-2003
Ubicación: Catalonia
Mensajes: 4.334
Antigüedad: 20 años, 7 meses
Puntos: 156
Re: Saber si un form esta abierto

yo lo hago siguiendo el patrón SingletonPattern, (en VB.NET 2003)

En el form hijo:

Cita:
#Region " Windows Form Designer generated code "

'singleton patern
Private Shared fHijo As frmHijo= Nothing

Public Shared Function Instance() As frmHijo
If fHijo Is Nothing Then
fHijo= New frmHijo
End If
fHijo.Focus()
Return fHijo
End Function 'Instance

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
fHijo= Nothing
End Sub

.
.
.
En el form Padre:
Cita:
Private Sub mnMostrarForm_ItemClick(ByVal sender As System.Object, ByVal e As DevExpress.XtraBars.ItemClickEventArgs) Handles mnMostrarForm.ItemClick
Dim f As Form = frmHijo.Instance()
f.MdiParent = Me
f.Show()
f= Nothing
End Sub
Aunque también te vale si la app no es MDI. Eludes lo de mdiparent y ya está.

saludos