|
-
Apr 22nd, 2005, 05:52 AM
#1
Thread Starter
Fanatic Member
Module Scope variables...
I have a some variables that are declared in a vb webform class outside of any procedure. But when I set their values in one procedure, these variables are re-initialised when I access them in another procedure.
Is it not possible to use module scope variables in this way in webforms?
Perhaps I would be better creating session variables instead?
Last edited by simonm; Apr 22nd, 2005 at 06:59 AM.
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Apr 22nd, 2005, 06:05 AM
#2
Hyperactive Member
Re: Module Scope variables...
Declare them as 'shared' then you only have one instantiation of them.
I am assuming that vb 'shared' is the same as c# 'static'.
-
Apr 22nd, 2005, 06:18 AM
#3
Thread Starter
Fanatic Member
Re: Module Scope variables...
What will they be shared with? I don't want them shared with other sessions.
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Apr 22nd, 2005, 06:55 AM
#4
Hyperactive Member
Re: Module Scope variables...
If you want variables to be accessible between post backs but not accessible to other sessions then use session variables.
If you only want them to hold their values during a single instantiation of your class then declare them as normal in your class.
-
Apr 22nd, 2005, 06:59 AM
#5
Thread Starter
Fanatic Member
Re: Module Scope variables...
Oh I see...they get re-initialised every postback.
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Apr 22nd, 2005, 07:11 AM
#6
Hyperactive Member
Re: Module Scope variables...
Another way to store variable values is to use the view state, that way they are stored by the client. OK for small values.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|