Pinu Pinu -3 years ago 44
Vb.net Question

Passing argument to windows application

I need to be able to pass an argument to my windows application so that I can run the code based on the argument passed:

Below is the function that is called when the windows application start running:I need this method to have arguments.

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

Answer Source

If you mean command line argument, I don't think there's much you can do unless you add a property to your class. But you can always access the args through this function Environment.GetCommandLineArgs().

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download