Microsoft Communities

Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

Why do I receive duplicate trace messages for my trace statements?

This is possible if the same listener was added more than once to the Listeners list in Trace. This is possible even if an assembly that you linked to makes an additional entry for the same listener.

Perform a check like this before adding a listener.

if ( Trace.Listeners.Count == 0 ) 
{ 
  Trace.Listeners.Add( new TextWriterTraceListener( Console.Out ) ); 
  Trace.AutoFlush = true; 
  Trace.Indent(); 
} 

Contributed from George Shepherd's Windows Forms FAQ



Page view counter