Properties

barski

Junior Contributor
Joined
Apr 7, 2002
Messages
240
Location
Tennessee
I have a class let's call it "ThisClass" that has a boolean shared property named "Iseethis" that I set to "True" when certain users login. Does windows "destroy" this when the user leaves the website or is it something I'll need to handle in the code?
 
It's destroy as soon as the page is loaded, If you plan on doing something with it either do it right away before the page unloads or store it in a session variable, cookie etc...
 
Ummm! Are you sure about that? That's what I thought but if I go to another page after setting the value and do something like



dim x as string

x = ThisClass.Iseethis

it returns the value I set it to on the opening page.
 
Of course it is not destroyed. You are talking about shared variables.

Shared variables relate to a class and not to an instance of that class. Thus as long as the class is there, so they are.

Any members of the class relating to an instance (example public variables..) are destroyed once their instance is.

Hope this helps,
 
So if the user is at form whatever in my website and then they type www.yahoo.com in the address bar will everything be "destroyed" on my website or will it be this incremental "drain" on my server.
 
I don't think shared function will be destroyed. So in your case, you should not use 'Shared' because each user need his own object to it
 
Its not that but you should not use shared variables for user specific purposes, Shared variables as their name states are shared between all instances of the class.
 
Back
Top