您好我有五种表格,我想打开一个表格,如果它没有打开,如果它打开就会带到前面或焦点。我尝试过使用BringToFront
,Show
和TopMost
,但没有任何作用。
If Not Application.OpenForms.OfType(Of StudentRegistrationFrm).Any Then
StudentRegistrationFrm.ShowDialog()
Else
StudentRegistrationFrm.BringToFront()
'Me.SendToBack()
End If
答案 0 :(得分:0)
我已经通过关闭当前表单解决了这个问题。
If Not Application.OpenForms.OfType(Of StudentRegistrationFrm).Any Then
StudentRegistrationFrm.Show()
Else
Me.Close()
End If
Private Sub StudentInformationToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles StudentInformationToolStripMenuItem.Click
Dim studentReg As StudentInfoFrm = New StudentInfoFrm
studentReg.Show()
Me.Close()
End Sub