+ Reply to Thread
Results 1 to 3 of 3

Thread: Reading Command line arguments in VB.NET

  1. #1
    Join Date
    Apr 2009
    Location
    Uppsala, Sweden
    Posts
    9,547
    Blog Entries
    5
    Rep Power
    98

    Reading Command line arguments in VB.NET

    I will show you how to make a program which reads the Command line arguments from a program, it's pretty easy if you know how to do it


    First we declares a ReadOnlyCollection to store the value from our commandline.

    Code:
            Dim CommandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Application.CommandLineArgs
    The to get them one by one it's just to refer to its index, in the example below a messagebox will pop up with the arguments one by one.

    Code:
            For i As Integer = 0 To CommandLineArgs.Count - 1
                MessageBox.Show(CommandLineArgs(i))
            Next

    This was actually all the code but before publishing you need to remember to uncheck the "use .deploy file extension" checkbox:









    Now after publishing you will get the .exe file. If you create a shortcut to this .exe file you can add command line arguments to it as shown in the image below:




    Our program can now read these argument and one messagebox showing "Argument1" will be shown and then one showing "Argument2".


    That was it. Hope you liked it

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,466
    Blog Entries
    74
    Rep Power
    143

    Re: Reading Command line arguments in VB.NET

    I like +rep
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    Jordan Guest

    Re: Reading Command line arguments in VB.NET

    Very thorough! Nice work. +rep

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 7 users browsing this thread. (0 members and 7 guests)

Similar Threads

  1. problem with command line arguments
    By csepraveenkumar in forum Java Help
    Replies: 1
    Last Post: 05-17-2011, 09:43 AM
  2. Command line arguments in DOS
    By Actor in forum Computer Software/OS
    Replies: 0
    Last Post: 05-18-2010, 12:57 AM
  3. Command Line Arguments
    By whitey6993 in forum C Tutorials
    Replies: 0
    Last Post: 04-04-2010, 12:57 PM
  4. [X86 ASM] Command line arguments demo
    By Sysop_fb in forum Classes and Code Snippets
    Replies: 0
    Last Post: 02-12-2010, 07:38 AM
  5. Reading Command Line Arguments
    By Guest in forum C Tutorials
    Replies: 18
    Last Post: 02-01-2010, 02:34 PM

Tags for this Thread

Bookmarks

Posting Permissions

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