我在这里有一些代码,要求用户先打开他之前打开的窗口,然后打开另一个窗口,或告诉用户他要打开的窗口已经打开。 我打开的表格会保持打开状态,打开时不会被最小化。
Private Sub FindClientToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FindClientToolStripMenuItem.Click
'Close items form
Dim Close_items As New Form_items
'Call find client form when clicking tab Find client
Dim ShowFindClient As New Find_Client
'If the find_items form or window is opened, then a message prompts the user to close it first
If Application.OpenForms().OfType(Of Form_items).Any Then
playErrorSound()
MsgBox("Close Find_items window first", MsgBoxStyle.OkOnly, "MDCS")
'If find_clients form is opened. the user can not open it twice.
ElseIf Application.OpenForms().OfType(Of Find_Client).Any Then
playErrorSound()
MsgBox("The Window is already opened", MsgBoxStyle.OkOnly, "MDCS")
Else
'If the find_client window is not opened, it opens.
ShowFindClient.Show()
End If
End Sub
答案 0 :(得分:1)
在您的情况下使用Me.MinimizeBox = False
,您可以在表单加载中禁用它,如下所示:
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.MinimizeBox = False
End Sub