How to use the command-line argument

  • Thread starter Thread starter Ken
  • Start date Start date
K

Ken

I would like to programmatically use the command line argument in vb dot
net. In vb6 it was easy, you just use the Command$ variable. How do I use it
in vb dot net?

Any help would be appreciated.
 
Here is one way:

Dim arg As String
For Each arg In Environment.GetCommandLineArgs
Debug.WriteLine(arg)
Next

OR

Public Sub Main(ByVal args As String( ))
End Sub

Also see link for passing to Sub New...

http://tinyurl.com/46j2y

HTH,
Greg
 
* "Ken said:
I would like to programmatically use the command line argument in vb dot
net. In vb6 it was easy, you just use the Command$ variable. How do I use it
in vb dot net?

I prefer this solution:

\\\
Public Module Program
Public Sub Main(ByVal Args() As String)
...
End Sub
End Module
///

Select 'Sub Main' as startup object in the project properties.
 

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

Back
Top