Command Line Arguments

M

Milan

Hi,

Please guide me how to set command line argument and
how to retrive command line argument.

Senario: vb.net application should be able to execute from command
prompt by passing login and password and should be able to execute
process form (with his parameter)
User should not be able to see GUI

Milan
 
T

Tim Patrick

Visual Basic includes a "Command" function that provides all command-line
arguments as an entire string. In VB2005, you can also use the My.Application.CommandLineArgs
property, which provides a collection of the individual arguments.

When running your program within Visual Studio, you can set temporary command-line
arguments through the Project Properties form. Choose the Debug tab, and
then fill in the "Command line arguments" field as needed.
 
H

Herfried K. Wagner [MVP]

Milan said:
Please guide me how to set command line argument and
how to retrive command line argument.

Senario: vb.net application should be able to execute from command
prompt by passing login and password and should be able to execute
process form (with his parameter)
User should not be able to see GUI

Select 'Sub Main' in the project's properties as startup object and add this
code to your project:

\\\
Public Module Program
Public Sub Main(ByVal Args() As String)
If Args.Length > 0 Then
If ... Then
Application.Run(New MainForm())
Else
...
End If
Else
...
End If
End Sub
End Module
///
 

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