CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 1999
    Posts
    20

    Command Line Arguments passing in VB5.0

    How to use “Command Line Arguments:” of “Make” tab in “Project Properties” window of Visual basic 5.0 project?

    I have developed a Visual basic 5.0 application. The application works just fine in the user interactive mode.
    However, I now want it to run from the command prompt and want to pass command line arguments to the application as well. If arguments were passed, application would run accordingly other wise it would run in the normal user interactive mode.
    How can I do that?
    For example, my application’s first screen asks user to enter user id and password. I want my program to except user id and password information from the command line.
    If the executable application is MyApp.exe, following command would ask user to enter user id and password in user interactive mode
    C:>MyApp.exe
    However, I want my application to run for any of the following commands, in that case it would not ask for user id and password at run time.
    C:>MyApp.exe userid password
    or
    C:>MyApp.exe –U userid –P password


    Any suggestions, help would be greatly appreciated.

    Thanks a lot in advance for your help
    Dhirendra
    [email protected]





  2. #2
    Join Date
    Sep 1999
    Location
    Germany
    Posts
    66

    Re: Command Line Arguments passing in VB5.0

    You need use the Command function to get the command line arguments.

    Dim CmdLine as string
    CmdLine = Command()



    If you run your application like
    MyApp.exe userid password


    then CmdLine is "userid password".

    Use “Command Line Arguments:” of “Make” tab in “Project Properties” window for test this option.

    Best Regards.

    [email protected]
    http://vbcode.webhostme.com/

  3. #3
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Command Line Arguments passing in VB5.0

    There's a good example of handling multiple command line arguments at :

    http://codeguru.developer.com/vb/articles/1755.shtml



    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured