繁体   English   中英

无法将打开的表单带到前台/焦点vb.net

[英]Unable to bring opened form to front/focus vb.net

嗨,我有五种形式,并且我只想在未打开的情况下打开一种形式,如果它是开放的,那么请先关注或关注。 我曾尝试使用BringToFrontShowTopMost但没有任何效果。

If Not Application.OpenForms.OfType(Of StudentRegistrationFrm).Any Then
        StudentRegistrationFrm.ShowDialog()
    Else
        StudentRegistrationFrm.BringToFront()
        'Me.SendToBack()
End If

我已经通过关闭当前表单解决了它。

 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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM