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?
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'.
Re: Module Scope variables...
What will they be shared with? I don't want them shared with other sessions.
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.
Re: Module Scope variables...
Oh I see...they get re-initialised every postback. :eek2:
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.