When running an application that requires command line parameters, everyone knows how to
run the .EXE and pass parameters. But, how do you do it from Visual Studio while
debugging?
First, let's see how to set up your app to allow parameters in the first place.
[STAThread]
static void Main(string[] parms)
{
if (parms.Length > 0)
{
// do something with the parameters
}
Application.Run(new Form1());
}
And now to be able to debug with parameters, right-click on your Windows Application project and
choose Properties. Go to the "Debug" tab, and enter your parameters in the "Command Line Arguments"
TextBox.
Note that the parameters are space-delimited.
Also note that you must either tab out of the TextBox or otherwise leave the TextBox (mouse-click)
after you've made any change to the Command Line Arguments, ... you'll get an error if you don't
(I'd say that's a bug, but it's only a minor annoyance if you forget to do it).
from a solution provided by Eric Moreau in Message #1065158
|