Okay, I can see how to add parameters from within the Project's Property
dialog(I assume you can add the same parameters after projectname.exe
from a run command prompt). But, how can you recover the value of theses
parameters from within your code at run time. I just can't seem to find
this in the help files.
You'll need to do this in your application entry point. I like to start my
applications like so:
Public Class ApplicationEntryPoint
<STAThread()> _
Public Shared Sub Main(ByVal cmdArgs() As String)
'The cmdArgs parameter contains the command line arguments.
Application.Run('Whatever)
End Sub
Okay, I can see how to add parameters from within the Project's
Property dialog(I assume you can add the same parameters after
projectname.exe from a run command prompt). But, how can you recover the
value of theses parameters from within your code at run time. I just
can't seem to find this in the help files.
\\\
Public Sub Main(ByVal astrCmdLineArgs() As String)
Dim i As Integer
For i = 0 To astrCmdLineArgs.Length - 1
Console.WriteLine(astrCmdLineArgs(i))
Next i
End Sub
///
- or -
\\\
Public Sub Main()
Dim i As Integer
For i = 0 To Environment.GetCommandLineArgs().Length - 1
Console.WriteLine(Environment.GetCommandLineArgs(i))
Next i
End Sub
///
Notice that the startup object must be set to 'Sub Main'.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.