How to do global vars?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • VB Programmer

    #1

    How to do global vars?

    How do you define a variable as global in VB.NET 2005? Thanks.


  • CT

    #2
    Re: How to do global vars?

    Add a Public variable to a module.

    --
    Carsten Thomsen
    Communities - http://community.integratedsolutions.dk

    "VB Programmer" <dont@emailme.c om> wrote in message
    news:OwJtcj13FH A.3540@TK2MSFTN GP10.phx.gbl...[color=blue]
    > How do you define a variable as global in VB.NET 2005? Thanks.
    >[/color]


    Comment

    • Cor Ligthert [MVP]

      #3
      Re: How to do global vars?

      > How do you define a variable as global in VB.NET 2005? Thanks.

      VB Programmer in the same way as in the the other VB.Net versions.

      By instance global to a class by to declare it private outside a method.

      I hope this helps,

      Cor


      Comment

      • M. Posseth

        #4
        RE: How to do global vars?

        the easiest way would be to use a module with a public / friend scoped
        declaration
        ( i would prefer Friend )

        please note that you should avoid global scoped variabels

        a better aproach would be to encapsulate your logic in a singleton like
        base class
        that passes all required parameters to its co classes .

        you might also investigate the shared keyword

        regards

        Michel Posseth [MCP]



        "VB Programmer" wrote:
        [color=blue]
        > How do you define a variable as global in VB.NET 2005? Thanks.
        >
        >
        >[/color]

        Comment

        Working...