VB Console App Command Line Arguments 
Author Message
 VB Console App Command Line Arguments

How do you take command line parameters for use in a VB Console app?

MMc



Sat, 19 Nov 2005 11:05:59 GMT  
 VB Console App Command Line Arguments

Quote:
> How do you take command line parameters for use in a VB Console app?

Microsoft.VisualBasic.Command()

--

Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/



Sat, 19 Nov 2005 11:13:10 GMT  
 VB Console App Command Line Arguments

Quote:
>How do you take command line parameters for use in a VB Console app?

Sub Main(CmdArgs() As String)
         ^^^^^^^^^^^^^^^^^^^

Mattias

===

http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.



Sat, 19 Nov 2005 17:27:06 GMT  
 VB Console App Command Line Arguments
Hello,


Quote:
> How do you take command line parameters for use in a VB Console app?

\\\
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



Sun, 20 Nov 2005 00:09:00 GMT  
 VB Console App Command Line Arguments
In your Sub Main, it should be declared as:

Public Sub Main(Arguments() As String)

    For Each strArgument As String In Arguments
        ...
    Next

End Sub

--
Happy to help,
-- Tom Spink

Please respond to the newsgroup,
so all can benefit.

One Day,

Quote:
> How do you take command line parameters for use in a VB Console app?

> MMc



Sun, 20 Nov 2005 00:21:28 GMT  
 VB Console App Command Line Arguments
Tom,
How would you go about this if your app doesn't have a Main()--i.e. it
starts with a form?

Quote:

> In your Sub Main, it should be declared as:

> Public Sub Main(Arguments() As String)

>     For Each strArgument As String In Arguments
>         ...
>     Next

> End Sub

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


--
==================================================================
Sam J. Marrocco
Sr. Visual Effects Artist/R&D
Travelling Pictures/GTN
Inferno, Flame, Houdini, Maya, All that cool stuff!
"The fact that no one understands you doesn't make you an artist."
==================================================================


Sun, 20 Nov 2005 11:40:54 GMT  
 VB Console App Command Line Arguments
Hello,


Quote:
> How would you go about this if your app doesn't have a Main()--i.e. it
> starts with a form?

\\\
For i = 0 To Environment.GetCommandLineArgs().Length - 1
    MsgBox(Environment.GetCommandLineArgs(i))
Next i
///

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



Sun, 20 Nov 2005 19:40:19 GMT  
 VB Console App Command Line Arguments
Just like that :)

Or in 2003

For Each strArg As String In Environment.GetCommandLineArgs
    MsgBox(strArg)
Next

--
Happy to help,
-- Tom Spink

Please respond to the newsgroup,
so all can benefit.

One Day,


Quote:
> Hello,


> > How would you go about this if your app doesn't have a Main()--i.e. it
> > starts with a form?

> \\\
> For i = 0 To Environment.GetCommandLineArgs().Length - 1
>     MsgBox(Environment.GetCommandLineArgs(i))
> Next i
> ///

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



Sun, 20 Nov 2005 20:11:07 GMT  
 VB Console App Command Line Arguments
Hello Tom,


Quote:
> For Each strArg As String In Environment.GetCommandLineArgs
>     MsgBox(strArg)
> Next

*ugly*

;-)))

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



Sun, 20 Nov 2005 20:39:01 GMT  
 VB Console App Command Line Arguments
Whats wrong with that??? ;-)))

--
Happy to help,
-- Tom Spink

Please respond to the newsgroup,
so all can benefit.

One Day,


Quote:
> Hello Tom,


> > For Each strArg As String In Environment.GetCommandLineArgs
> >     MsgBox(strArg)
> > Next

> *ugly*

> ;-)))

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



Sun, 20 Nov 2005 22:36:52 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. How to read in command line arguments from a VB app

2. console app and command line parameters

3. Executing command to command line from VB App

4. How to get command line arguments from VB.Net Console App?

5. Command-Line arguments using Command()

6. VB.NET Command Line Arguments

7. HowTo get command line arguments with VB.Net???

8. VB command-line arguments

9. Help with VB command line arguments

10. VB command line exe and arguments

11. Passing arguments to a vb .exe file from the command line

12. Passing command line arguments to OCX in VB?

 

 
Powered by phpBB® Forum Software