我需要能够将参数传递给我的Windows应用程序,以便我可以根据传递的参数运行代码:
以下是Windows应用程序开始运行时调用的函数:我需要此方法来获取参数。
Private Sub Start_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim Mgr As New StartMgr
Mgr.Import() // from here controls goes to a class library and it the whole //code, I need this function Import(arg) so that it can run partial code based on args
Me.Visible = False
Me.Close()
Catch ex As Exception
Finally
Application.Exit()
End Try
End Sub
答案 0 :(得分:2)
如果您的意思是命令行参数,除非您在课堂上添加属性,否则我不会认为您可以做很多事情。但是你总是可以通过这个函数Environment.GetCommandLineArgs()访问args。
答案 1 :(得分:0)
Fácilpodéisusaresto
Dim args As String() = Environment.GetCommandLineArgs()
TextBox1.Text = String.Join(".", args)