我的项目中有一个表单。这个表单只是用来通知其他应用程序(例如,外部ActiveX-exe)我的应用程序仍然处于活动状态。
我在主表单中这样声明了它:
Private m_fVirtualContainer As frmVirtualContainer现在,当我实例化它时,我说:
m_fVirtualContainer = New frmVirtualContainer但是,这不会触发窗体的"Load“事件。
我必须添加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但我认为并希望这是一种夸张的说法。我只想加载表单,而不是显示它。
有人能告诉我怎么做吗?谢谢!
发布于 2014-02-19 06:21:03
添加一个新的模块到项目中,这将作为项目的启动对象。
Sub Main()
' Instantiate a new instance of Form1.
Dim f1 as New Form1()
' Display a messagebox. This shows the application is running,
' yet there is nothing shown to the user. This is the point at
' which you customize your form.
System.Windows.Forms.MessageBox.Show("The application is running now, but no forms have been shown.")
' Customize the form.
f1.Text = "Running Form"
' Show the instance of the form modally.
f1.ShowDialog()
End Subhttps://stackoverflow.com/questions/21866280
复制相似问题