How do you get command line parameters in CF

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
 
M

Michel Renaud

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.
 
N

Neil Cowburn [MVP]

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
 
Joined
Jun 24, 2005
Messages
1
Reaction score
0
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 :)
 

Ask a Question

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.

Ask a Question

Top