Global variable

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

How can I define a solution/project wide variable?

Thanks

Regards
 
By defining this var in a module

however it would be better parctice to code your project in such a way that
global ars are not necessary
you could for instance define a start class with a singletong aproach , this
class will pas all required parameters
to its worker classes


regards

Michel Posseth
 
Perhaps the OP is really looking for a configuration constant rather than a
variable ?, it;s not really clear what he wants this functionality for.
 
Well I need to keep a record of if what view user is currently in. It could
be 'Current' accounts or 'Prospect' accounts. By defining a global variable
I would like to set it to either Current or Prospect depending on what view
is current. Is there a better way to do this?

Thanks

Regards
 
PS: This variable is then passed on to the underlying query to bring up the
correct records.
 
If however, you want a variable which is available to a specific user all
over the application then use the Session("MyVariableName") to store it in
this can be accessed anyywhere by assigning its value to a local variable.




HTH
 
was the original poster talking about a ASP.net application ???? or did you
found a way to mimick this behavior in a VB.net applications ??
 
there is always an easy way and a better way :-)

the easy way is to define the value in a module

the better way is to design your proggy to OOP standards where global skoped
values are not necessarry at all as the singleton like class contains all
valid information it can pass all necessary information to the child /
worker classes, however this approach might require you to redesign your
hole app

regrds

M. Posseth
 
Sorry, you know I flit between groups and I thought I was in the ASP.NET
group

Sorry n All
 

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

Similar Threads


Back
Top