Imports

G

Guest

If I put
imports xxx.ModuleName
at the top of my asp.net page vb code, does this create an instance of the
imported module that is unique to the page or does it just allow shared
access to the module's functions?
cheers,
jsale
 
P

Patrice

Imports is just a notation that instructs the compiler to look into a
particular namespace when a name is found that doesn't seem to belong to the
"current" namespace.
It doesn't do "things" like creating an instance of a module.

It looks like what you are looking is that a module is actually a class with
shared members (my personal preference would be to use this instead, you
loose just the ability to call its members wihtout appending the class name
before)...
 
G

Guest

if i made the module into a class and instanced it on each page that uses the
functions, would i be right in saying that there is no real way data could be
'leaked' between users?
you may remember me from some session questions last week - i'm still having
problems with the information appearing on different users' screens and my
main thought is that using the modules, they;re not instanced at any point,
therefore if more than one user is using them at once, there could be leakage
and errors. maybe... :)
cheers for the information patrice :)
 
S

Shiva

Imports doesn't instantiate any modules/types. Its just for type name
resolution only. It has effect only in the included page.

If I put
imports xxx.ModuleName
at the top of my asp.net page vb code, does this create an instance of the
imported module that is unique to the page or does it just allow shared
access to the module's functions?
cheers,
jsale
 
P

Patrice

Actually the problme is that shared members (either as members of a class or
implicitely in a module are "shared" by the whole application and an ASP.NET
site is a single application.
As a result, users are sharing the same variables.

You shouldn't use modules or a class with shared members. use a class and
instantie this class for each user so that they have each their own copy...

Patrice

--
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top