0
我在我的項目中有一個窗體。此表單僅用於向其他應用程序(例如外部ActiveX-exes)指示我的應用程序仍然存在。VB.NET:加載表單並隱藏它
我已經在主要形式宣佈它是這樣的:
Private m_fVirtualContainer As frmVirtualContainer
現在,當我實例化,我說:
m_fVirtualContainer = New frmVirtualContainer
不過,這並不會觸發窗體的「加載」事件。
我要補充 m_fVirtualContainer.Show()
...觸發Load事件。
在我有以下子形式:
Private Sub frmVirtualContainer_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Visible = False
End Sub
但我認爲並希望這是矯枉過正。 我只想加載表單,而不是顯示它。
有人可以告訴我該怎麼做嗎? 謝謝!
爲什麼不把你需要的代碼放在窗體的構造函數中?我不認爲你可以從加載中取消表單的實際顯示。 Load()僅在Form.Show()afaik上調用。 – Brandon
你的意思是? – tmighty
其實,我想你可以破解它..看到這個鏈接。 http://stackoverflow.com/questions/11148671/cancel-form-load – Brandon