Log file

  • Thread starter Thread starter leo
  • Start date Start date
L

leo

My application need make log file for user behavior.
like time.

To do that, I declared a public streamwriter points to a
txt file in module level to make it accessible within the
whole project. I used this streamwriter in the form_load
event and output the time of form loading.

However, only the first time I run it, it works normally.
The rest of running failed with system.NullReferenceError.
Is there other method can achieve this purpose?

Thanks!
 
* "leo said:
My application need make log file for user behavior.
like time.

To do that, I declared a public streamwriter points to a
txt file in module level to make it accessible within the
whole project. I used this streamwriter in the form_load
event and output the time of form loading.

However, only the first time I run it, it works normally.
The rest of running failed with system.NullReferenceError.
Is there other method can achieve this purpose?

Post some code. Are you sure, you instantiate the 'StreamWriter'?
 
Back
Top