How to get Command Line argument? 
Author Message
 How to get Command Line argument?

How can I get the command line argument for my Vb.net application?  Thanks.

Stacey



Wed, 23 Nov 2005 04:12:26 GMT  
 How to get Command Line argument?
If you are using a sub main, then declare your sub main like this:

Public Sub Main(Arguments() As String)
    ...
End Sub

Where Arguments() is an array of the command-line arguments

--
Happy to help,
-- Tom Spink

Please respond to the newsgroup,
so all can benefit.

One Day,

Quote:
> How can I get the command line argument for my Vb.net application?
Thanks.

> Stacey



Wed, 23 Nov 2005 04:26:07 GMT  
 How to get Command Line argument?
Hello,


Quote:
> How can I get the command line argument for my Vb.net
> application?

\\\
Public Module modMain
  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
End Module
///

-- or --

\\\
Public Module modMain
  Public Sub Main()
    Dim i As Integer
    For i = 0 To Environment.GetCommandLineArgs().Length - 1
      Console.WriteLine(Environment.GetCommandLineArgs(i))
    Next i
  End Sub
End Module
///

Regards,
Herfried K. Wagner
--
http://www.mvps.org/dotnet



Wed, 23 Nov 2005 04:38:25 GMT  
 How to get Command Line argument?
Thanks... Did not declare my main that way.. that fixed it.

Stacey

Quote:
> If you are using a sub main, then declare your sub main like this:

> Public Sub Main(Arguments() As String)
>     ...
> End Sub

> Where Arguments() is an array of the command-line arguments

> --
> Happy to help,
> -- Tom Spink

> Please respond to the newsgroup,
> so all can benefit.

> One Day,


> > How can I get the command line argument for my Vb.net application?
> Thanks.

> > Stacey



Wed, 23 Nov 2005 04:46:27 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Getting command line arguments...

2. Getting the COMMAND line arguments in QBASIC

3. Getting the command line arguments

4. Getting command line arguments with Win32_process

5. Command-Line arguments using Command()

6. "/decompile" command line argument

7. command line arguments for project files

8. Command Line arguments for Project

9. Project_Open and command Line arguments in MSP2k

10. Command Line Arguments

11. command line arguments

12. command line arguments

 

 
Powered by phpBB® Forum Software