We help IT Professionals succeed at work.
Get Started

What is the best way to create Application and Error log files that the end user can view?

weiroblpay asked
Last Modified: 2012-06-27
I'm new to VB .NET.
I have an application that I need to record a log file of things that take place while the application is running. This log file then needs to be viewed / printed by the user when the processing is done (or application is closed). It will only be used by 1 user at a time.

I have a class that takes care of creating the log file and writing entries to it, but he problem I have is how to manage it so different parts of the program can use the class and still write to the same file.

In the past (with VB6), I just put a global log object in the startup class and used that global object in every other part of the program.
In a module, I put something like this:
Public g_objLog as clsAppLog

Then I would just use g_objLog from anywhere in the application I needed to.

What's the best way to accomplish the same thing in VB .NET?  Can I have a global object?


Watch Question
IT Business Analyst
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE