none
How to pass arguments to VB.NEt Windows Application (exe file)? RRS feed

  • Question


  • Hi,

    How do I pass the arguments to executable file when I invoke from command line? Any example using Environment.GetCommandLineArgs().

    If I start my testapp.exe with argument of myString, it prints System.String[] as my first value of string array. Not the value. Why is that?


    I see something similar stuiff discussed here:
    http://msdn2.microsoft.com/en-us/library/system.environment.getcommandlineargs(VS.71).aspx
    But, they dont have anything for executable file? I want to access the argument inside my VB.NEt program. Any tips would be great help.

    Thanks
    Ramesh
    Wednesday, February 27, 2008 5:43 AM

Answers

  • Hi,


    This one did what I wanted. Sorry for early question.


    Dim returnValue As String()
            returnValue = Environment.GetCommandLineArgs()
            If returnValue.Length > 1 Then
                MessageBox.Show(returnValue(1).ToString())
            Else
                MessageBox.Show("Nothing")
    End If

    Thanks
    Ramesh
    Wednesday, February 27, 2008 5:59 AM