Home All Groups Group Topic Archive Search About
Author
17 Apr 2007 7:32 PM
Elmo Watson
I have a handfull of variables that I'd like to make Global to my
application
In the old VB6 days, I'd create a Module, and put them there, accessible
from any form in the application

However, in VS.Net 2005, I added a module, and it acts somewhat like a
class, in that, to access a Public variable, there, I must precede the
variable name with the module name, like:
mdlVars.MyVar

Is this pretty much how it's done, or, if not,  what's a more acceptible
approach?

Author
18 Apr 2007 12:22 AM
Bryan Phillips
The module is the best place for it but you can still live up the old
days by adding an import to the project with the full name of your
module (including the namespace).

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog:  http://bphillips76.spaces.live.com
Web Site:  http://www.composablesystems.net



Show quoteHide quote
"Elmo Watson" <wha***@yahoo.com> wrote in message
news:OGlyucSgHHA.3676@TK2MSFTNGP05.phx.gbl:

> I have a handfull of variables that I'd like to make Global to my
> application
> In the old VB6 days, I'd create a Module, and put them there, accessible
> from any form in the application
>
> However, in VS.Net 2005, I added a module, and it acts somewhat like a
> class, in that, to access a Public variable, there, I must precede the
> variable name with the module name, like:
> mdlVars.MyVar
>
> Is this pretty much how it's done, or, if not,  what's a more acceptible
> approach?
Are all your drivers up to date? click for free checkup

Author
18 Apr 2007 1:19 AM
AlexS
I would suggest class with static members and related properties

Something like this

public class Globals {
    internal static <type> globVar1;
    ...

public static <type> Var1 {
get {
    return globVar1;
}
}
....
}

Then you can get your global like this:

myVar = Globals.Var1;

You can compile class into dll or use directly in the app.

Alex

Show quoteHide quote
"Elmo Watson" <wha***@yahoo.com> wrote in message
news:OGlyucSgHHA.3676@TK2MSFTNGP05.phx.gbl...
>I have a handfull of variables that I'd like to make Global to my
>application
> In the old VB6 days, I'd create a Module, and put them there, accessible
> from any form in the application
>
> However, in VS.Net 2005, I added a module, and it acts somewhat like a
> class, in that, to access a Public variable, there, I must precede the
> variable name with the module name, like:
> mdlVars.MyVar
>
> Is this pretty much how it's done, or, if not,  what's a more acceptible
> approach?
>

Bookmark and Share