Solved

Why isn't argument passed in?

Posted on 2007-03-30
8
203 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
 

Author Comment

by:brettr
ID: 18824078
Arg!  You're absolutely right.  These are only available when compiling in debug right?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

895 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

17 Experts available now in Live!

Get 1:1 Help Now