Click here to Skip to main content
15,915,094 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to use app.config file ? Pin
hdv21212-Feb-06 13:11
hdv21212-Feb-06 13:11 
GeneralRe: how to use app.config file ? Pin
Ravi Bhavnani12-Feb-06 13:18
professionalRavi Bhavnani12-Feb-06 13:18 
GeneralRe: how to use app.config file ? Pin
J4amieC12-Feb-06 21:20
J4amieC12-Feb-06 21:20 
QuestionPassing command line arguments to the main method Pin
kourvoisier12-Feb-06 9:33
kourvoisier12-Feb-06 9:33 
AnswerRe: Passing command line arguments to the main method Pin
User 665812-Feb-06 9:41
User 665812-Feb-06 9:41 
GeneralRe: Passing command line arguments to the main method Pin
Wayne Phipps12-Feb-06 10:07
Wayne Phipps12-Feb-06 10:07 
GeneralRe: Passing command line arguments to the main method Pin
kourvoisier12-Feb-06 10:44
kourvoisier12-Feb-06 10:44 
QuestionTraceSwitch doesn't get settings from App.config Pin
Optimus Chaos12-Feb-06 4:31
Optimus Chaos12-Feb-06 4:31 
Hi folks,

I have a problem concerning a TraceSwitch I'm using in one of my recent projects:

I have a library assembly which is being referenced from a Windows service. Within this library I have several classes, dealing with file searching and parsing. the classes are designed for general use, so I don't write errors from the library in the Event Log. To enable tracing in the library I created a static class with two static members, the switch and the TraceListener (will write to a text file). For the library I created an App.config file withe the following XML code:

<br />
<system.diagnostics><br />
    <switches><br />
        <add name="ParsingLibTraceSwitch" value="3" /><br />
    </switches><br />
</system.diagnostics><br />


The code for the Tracing class is like this:

<br />
namespace ParsingLib<br />
{<br />
    public static class Tracing<br />
    {<br />
        private static TraceSwitch tracer = new TraceSwitch ( "ParsingLibTraceSwitch",<br />
            "Enables tracing for the ParsingLib assembly" );<br />
<br />
        private static TextWriterTraceListener traceListener = <br />
            new TextWriterTraceListener ( "ParsingLib_Trace.txt" );<br />
<br />
        public static TraceSwitch Switch<br />
        {<br />
            get { return tracer; }<br />
        }<br />
<br />
        public static TraceListener Listener<br />
        {<br />
            get { return traceListener; }<br />
        }<br />
    }<br />
}<br />


However, if I run and debug the service, the TraceLevel of the Switch is always TraceLevel.Off.

Does anyone of you have an idea what's wrong with the code? I'm using VS 2005.

Thank you in advance.
QuestionHow To Load App Setting From Registry ? Pin
hdv21212-Feb-06 1:55
hdv21212-Feb-06 1:55 
AnswerRe: How To Load App Setting From Registry ? Pin
Wayne Phipps12-Feb-06 2:09
Wayne Phipps12-Feb-06 2:09 
GeneralRe: How To Load App Setting From Registry ? Pin
hdv21212-Feb-06 2:25
hdv21212-Feb-06 2:25 
GeneralRe: How To Load App Setting From Registry ? Pin
Wayne Phipps12-Feb-06 3:27
Wayne Phipps12-Feb-06 3:27 
Questiondatagrid Pin
Gamil Mohamad12-Feb-06 1:02
Gamil Mohamad12-Feb-06 1:02 
QuestionPrinting question Pin
Timothy_198211-Feb-06 23:06
Timothy_198211-Feb-06 23:06 
Questionexecuting function in Parent FORM from Child FORM Pin
emran83411-Feb-06 21:52
emran83411-Feb-06 21:52 
AnswerRe: executing function in Parent FORM from Child FORM Pin
nta13711-Feb-06 22:16
nta13711-Feb-06 22:16 
GeneralRe: executing function in Parent FORM from Child FORM Pin
emran83412-Feb-06 0:00
emran83412-Feb-06 0:00 
GeneralRe: executing function in Parent FORM from Child FORM Pin
Josh Smith12-Feb-06 12:17
Josh Smith12-Feb-06 12:17 
GeneralRe: executing function in Parent FORM from Child FORM Pin
emran83413-Feb-06 8:26
emran83413-Feb-06 8:26 
GeneralRe: Working Excellent.... Pin
emran83413-Feb-06 12:34
emran83413-Feb-06 12:34 
AnswerRe: executing function in Parent FORM from Child FORM Pin
Colin Angus Mackay12-Feb-06 1:38
Colin Angus Mackay12-Feb-06 1:38 
GeneralRe: executing function in Parent FORM from Child FORM Pin
S. Senthil Kumar12-Feb-06 14:00
S. Senthil Kumar12-Feb-06 14:00 
GeneralRe: executing function in Parent FORM from Child FORM Pin
Colin Angus Mackay13-Feb-06 8:32
Colin Angus Mackay13-Feb-06 8:32 
GeneralRe: executing function in Parent FORM from Child FORM Pin
emran83413-Feb-06 8:23
emran83413-Feb-06 8:23 
GeneralRe: executing function in Parent FORM from Child FORM Pin
Colin Angus Mackay13-Feb-06 8:35
Colin Angus Mackay13-Feb-06 8:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.