你当然可以!
在"项目属性"中,将"启动对象"设置为"Sub Main",并确保应用程序中的某个位置有Public Sub Main方法.一个单独的启动类可能是一个好主意:
Public Class myStartupClass
''' <summary>
''' This is the method that will be run when the application loads,
''' because Project Properties, Startup Object is set to SubMain
''' </summary>
''' <remarks>
''' </remarks>
''' --------------------------------------------------------------------------------
Public Shared Sub Main()
'The form that we will end up showing
Dim formToShow As System.Windows.Forms.Form = Nothing
'The determiner as to which form to show
Dim myMood As String = "Happy"
'Choose the appropriate form
Select Case myMood
Case "Happy"
formToShow = New Form1
Case Else
formToShow = New Form2
End Select
'Show the form, and keep it open until it's explicitly closed.
formToShow.ShowDialog()
End Sub
Run Code Online (Sandbox Code Playgroud)
End Class