How to create application wide var?

  • Thread starter Thread starter Brett Romero
  • Start date Start date
B

Brett Romero

I'd like to create an application wide variable in a winform app. I
can do this on my start up form by reading in some values from a config
file (since these values may change in the future) and assigning them
to a public var. From there, I'd always have to reference the start up
form. Is there a better way?

Thanks,
Brett
 
Great! I actually created a DLL with a structure and reference them
from there, since it will be used across a few apps.

I do this through out my application. It is all winforms. I'd like to
put the code below into one place and reference it. It has to be an
instance as you can see. I want to abstract it somehow because the
enum references below could change and I don't want to go through the
app doing find/replace.

private ErrorHandling.LogErrors ErrorHandler = new
ErrorHandling.LogErrors(Configuration.ErrorLogging.Tracker_EventLogSource,
Configuration.ErrorLogging.Tracker_EventLogName);

Brett
 

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