473,326 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to create application wide var?

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

Dec 7 '05 #1
2 1447
You can create a class with static fields that you can access.

"Brett Romero" <ac*****@cygen.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
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

Dec 7 '05 #2
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

Dec 8 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mr.Tickle | last post by:
Is it possible to determine when and what application crashed from within C# ? I want to send data over UDP to an application socket, and after that I want to determine whether its crashed or...
3
by: Jonathan Mcdougall | last post by:
I started using boost's filesystem library a couple of days ago. In its FAQ, it states "Wide-character names would provide an illusion of portability where portability does not in fact exist....
1
by: Jigar mehta | last post by:
Hye, How to create systemwide hooks for keyboard for keys like WIN, ALT+TAB, CTRL+ALT+DEL even when the application does not have the focus on it... Thanks,
6
by: Shibu | last post by:
Hi, Can anyone tell me how to create a DSN from asp.net.. Thanks Shibu
16
by: Fernando Arámburu | last post by:
Hi , it´s me again. I will take another way because yesterday I make a question and, probably I didn´t make myself clear so you didn´t understand my question. I want to know if there is any...
3
by: Opa | last post by:
Hi, Been stumped for many, many hours trying to create a web service project. I greatly appreciate any help. I get an error everytime I try to use the Visual Studio.NET wizard to create a...
2
by: Mark Olbert | last post by:
I want to bind a series of ObjectDataSource instances to an application-wide business object which caches the results of a database query. I'm confused about where/how to cache the results (it's...
11
by: Sylvia A. | last post by:
How can I define global classes in web application ? Classes can be set to session variables ? Thanks
3
by: =?Utf-8?B?Um9nZXIgVHJhbmNoZXo=?= | last post by:
Hello, I would like to know the best way to install an clickonce in .net 3.5 (we use LINQ 8-D) published application on terminal server 2003 Do I have to install it on EVERY user that will use...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.