Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Global properties or varables
Message
From
05/09/2005 20:02:52
 
 
To
05/09/2005 18:03:57
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01046793
Message ID:
01046871
Views:
14
Juan,

From your reply it is evident that you don't understand what a static value is.

Static variables are tied to the class, not an object. They are not garbage collected until the app is unloaded. As Bonnie has said, they are tied to the class, not an object. And they are available as soon as the class is loaded. You can change their values at anytime, and see the new value when you reference the variable.

For example, you can declare a static int inside a class. And use that as a counter, so everytime you instantiate an object from that class, you can increment your static, and you will always have a running total of how many times that class has been instantiated.

You would have to create a class to run Main, if it wasn't declared static.

>Bonnie: I know what you mean i create a public propertie in the midform and i set a value, but I can´t see that properties in the child forms where should i declare the propertie to be accessible for all forms, it is not a static value it is fixed by users and may be changed.
>
>Thank's
>
>>Juan,
>>
>>>is about an ini or configuration file which i use for set connection strings, i would like to use the custom object to retrieve and store info without using a file <
>>
>>You might have missed what Cetin was referring to in the link to the thread he posted. He specifically talks about using static constants (although, in your case, you'd need to use static properties, complete with get and set methods). Read this again ... Message #1040896
>>
>>~~Bonnie
>>
>>
>>
>>
>>>Cetin:
>>> That's the way i use in fox , i store the custom object to a public variable or hang it on the _screen and i can read it from anywhere in my app, but i can't find the way in .net, the thread you pointed is about an ini or configuration file which i use for set connection strings, i would like to use the custom object to retrieve and store info without using a file for example i use a form to select a customer and i want to store his id in an object and then be accessed from any form in my application, as you said in fox i can keep that custom object as public variable or add it as an object to the _screen but i can not find the way in .net.
>>>
>>>i hope you ´ve understood me and tahnk you in advance for your help.
>>>
>>>
>>>>>In Vfox i use _screen to hang properties or objects that can be accessed by forms , i m trying to do the same in .Net using a mdiform in which i create some public properties but i can't find the way for those propeties in MdiForm may be accessed by child forms.
>>>>
>>>>Juan,
>>>>In VFP too normal way is to use a custom object (oMyApp) to store such info. You can do the similar in .Net. Check Thread #1040828 (it's C# but gives the idea).
>>>>Cetin

(On an infant's shirt): Already smarter than Bush
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform