Solved

Why isn't argument passed in?

Posted on 2007-03-30
8
204 Views
Last Modified: 2010-04-16
I have a winform app and set a conditional compilation symbol for the project.  In the Program.cs file, I do this:

[STAThread]
static void Main(string[] args )
{...}

but there is never anything in the args variable.  Do I need to do something else?
0
Comment
Question by:brettr
  • 4
  • 3
8 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18823761
the args is what you pass from the command line to the program.
do you pass anything to the program?
0
 

Author Comment

by:brettr
ID: 18823797
In the project properties for conditional compilation symbols, I specify a string.
0
 
LVL 25

Expert Comment

by:dstanley9
ID: 18823935
Those don't go to the args.  If you want to pass in arguments from studio, add them to the "Command Line Arguments" under the Debug tab
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:brettr
ID: 18824078
Arg!  You're absolutely right.  These are only available when compiling in debug right?
0
 
LVL 25

Expert Comment

by:dstanley9
ID: 18824098
No.  you can use different settings when building debug vs release modes, though.  They are used whenever you start the app from within studio (with or without debugging)
0
 

Author Comment

by:brettr
ID: 18824351
If I compile in release, it doesn't capture the argument.  Only when compiled in debug.
0
 
LVL 25

Accepted Solution

by:
dstanley9 earned 500 total points
ID: 18824378
Whan looking at the project properties, change the "Configuration" drop-down to Release and set the arguments there.  If you added the args in the Debug configuration, it doesn't automatically copy to other configurations. You can change the drop-down to "All" to set the same value in all configurations.
0
 

Author Comment

by:brettr
ID: 18824460
I see.  Thanks.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

815 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now