[求助]判断窗体是否已打开
如果窗体已经关闭就打开一个新的,如果已经打开则显示已经打开的窗体
Public Function midchi(ByVal frmName As String) As Boolean
Dim chiFrm As Windows.Forms.Form
For Each chiFrm In Me.MdiChildren
If chiFrm.Name = frmName Then
If chiFrm.Visible Then
chiFrm.Activate()
Else
chiFrm.Show()
End If
Return True
End If
Next
Return False
End Function
Private Sub MenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem7.Click
If midchi("frmComputer") Then
Exit Sub
End If
Dim frmCp As New frmComputer
frmCp.MdiParent = Me
frmCp.Show()
End Sub