Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Global Variables - Visible anywhere
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00657993
Message ID:
00658423
Views:
13
I think you would want a Main or application class/object in your solution. You can add properties to it to contain this type of information. These properties could be access from anywhere in your solution.

>hi guys,
>Is it possible in C# to define a global variable or property which can be accessed in the application.
>
>eg. 1. Connection string
>can I set the connection staring at the start of the application and then use it whenever I make a SQL connection.
>
>Eg. 2. Store a Companys Name which can be used on all reports & Forms
>
>in VFP I would create an Instance of an Enviromnet class and the every where I would reference those Properties
>
>Eg:
>oApp = CreateObject("Environment")
>
>form1.companyname.value = oApp.CompanyName
>or oApp.CompanyName = "ABC Ltd"
>
>
>Also
>is it possible to have a Global Error Handler as In VFP.
>
>On error do errorproc
>
>
>
>TIA
Previous
Reply
Map
View

Click here to load this message in the networking platform