barski Posted December 1, 2003 Posted December 1, 2003 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? Quote
Moderators Robby Posted December 1, 2003 Moderators Posted December 1, 2003 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... Quote Visit...Bassic Software
barski Posted December 1, 2003 Author Posted December 1, 2003 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. Quote
Mehyar Posted December 1, 2003 Posted December 1, 2003 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, Quote Dream as if you'll live forever, live as if you'll die today
barski Posted December 1, 2003 Author Posted December 1, 2003 So if the user is at form whatever in my website and then they type http://www.yahoo.com in the address bar will everything be "destroyed" on my website or will it be this incremental "drain" on my server. Quote
bungpeng Posted December 1, 2003 Posted December 1, 2003 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 Quote
Mehyar Posted December 1, 2003 Posted December 1, 2003 Shared will not be gone, other members will be destroyed... Quote Dream as if you'll live forever, live as if you'll die today
barski Posted December 1, 2003 Author Posted December 1, 2003 Not the answer I wanted to hear. Thanks for the help Quote
Mehyar Posted December 2, 2003 Posted December 2, 2003 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. Quote Dream as if you'll live forever, live as if you'll die today
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.