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'?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top