How do you get command line parameters in CF

  • Thread starter Thread starter Mark Tirschwell
  • Start date Start date
M

Mark Tirschwell

Hi all,

It seems that the microsoft.visualbasic.command function
isn't implemented in the CF.

Any ideas how to get command line arguments in a vb.net
program?

Thanks,

Mark
 
Any ideas how to get command line arguments in a vb.net

In the VS.Net help index, look for 'Main Procedure' -
you'll see the syntax to use when you need command line
arguments.
 
You need a Main method, something like this:

Public Shared Sub Main(ByVal args() as String)
...
End Sub

And then, if the project is Windows Forms project, you need to go to the
Project Properties and change the Startup Object to Sub Main

HTH
Neil
 
Really, there was a much easier way that I found to do this. You may call it directly from the load event of the form, and anywhere else I suppose.

Code:
Dim Parameters() As String = System.Environment.GetCommandLineArgs
Dim CommandLineArg As String

For Each CommandLineArg In Parameters
    If CommandLineArg <> Application.ExecutablePath Then
        MsgBox(CommandLineArg.ToString)
    End If
Next

Thanks, Hope it works :)
 
Back
Top