Scope of variables declared in .vb module files

A

Anand Sagar

If I declare a variable in a .vb module file , like
Public Module modMain
Public temp As String
End Module


I am able to access the variable temp in all the pages of my site. However,
I want to know if the variable temp above is a variable of session scope or
application scope.

Does anyone know ?


Thanks
Anand Sagar
(e-mail address removed)
 
J

John Saunders

Anand Sagar said:
If I declare a variable in a .vb module file , like
Public Module modMain
Public temp As String
End Module


I am able to access the variable temp in all the pages of my site. However,
I want to know if the variable temp above is a variable of session scope or
application scope.

Does anyone know ?

It's of application-wide scope, and probably requires synchronization code
if you're ever going to modify it.

My preference is to never use modules, but to use public classes instead.
Modules are a part of VB from before the days when it supported
object-orientation.
 
A

Anand Sagar

Thanks, That was a real quick answer.
;)


John Saunders said:
It's of application-wide scope, and probably requires synchronization code
if you're ever going to modify it.

My preference is to never use modules, but to use public classes instead.
Modules are a part of VB from before the days when it supported
object-orientation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top