 |
TraceListener creates huge log files
Lee Keable (2250 views)
TraceListener creates huge log files
If you've used the .Net trace listeners, you'll know that they just keep appending to the file specified in the App.Config file, this can lead to some massive log files Here's a simple TraceListener that logs to a new file for every day.
#c#using Syst
|
 |
Missing App.Path
Lee Keable (2183 views)
Missing App.Path
If you have the need to load resources (XSL stylesheets, images etc etc) at runtime, you may need to know the path of the currently executing code. In VB6 you'd just use good old App.Path, here is the .Net equivalent.
#c# using System.IO;
#c#
#c# string Location = Path.Ge
|
 |
Updating controls from another thread
Dave Howard (2580 views)
Updating form controls from another thread.
Form controls, by default, can only be updated by the forms thread. Otherwise an invoke must be used.
The example below shows a simple logging function that can be called by threads other than the forms.
#c#delegate void LogSafeCall(string s);
|
 |
System tray and balloon tips
Dave Howard (6170 views)
Balloon Tips from the System Tray
You can really easily add system tray function to .NET windows forms by dragging the NotifyIcon object onto your form.
You can then use this to display balloon tips from the system tray with the code below:
#c#myNotifyIcon.ShowBalloonTip(500, "Title", "Ti
|