Solved

Populating Command Line Arguments

Posted on 2006-11-14
2
208 Views
Last Modified: 2010-04-23
I have an application that can accept any number of command line arguments (using the Command() function).

Currently to test different scenarios, I have to constantly go into the Properties page and change the Command Line Arguments on the Debug tab.

I want to write a tester application that will open this form and I'd like to "populate" the command line arguments from vb.net.  Is this possible?

Note that I am not using the SHELL command or anything like that.  I am simply instantiating a form that uses the Command() function.
0
Comment
Question by:chlade
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 500 total points
ID: 17938619
Hi chlade,

You could do it with some conditional compilation. The command function is effectively readonly, however you could do this:

Dim MyCommandString As String
#If DEBUG Then
        MyCommandString = "Parameter1,Parameter2"
#Else
        MyCommandString = Command()
#End If

And then work with MyCommandString from then onwards. You could extend this to retrieve the parameters from wherever your tester form stores them. This will allow you to debug the code in the way that you want and will need no changes when it is released as the conditional compilation will only include the second option (using command()).

Tim Cottee
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 17939001
You can use Process.Start Method (String, String) in the testing application. It should contain Windows form with textbox and Start button. Textbox contains command line arguments filled by user. When Start button is clicked, execute the following code:

Process.Start Method ("tested-application-name.exe", textBox1.Text)

Other way is using Windows Run command, or batch file.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question