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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only