簡體   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