Results 1 to 7 of 7

Thread: Difference between Public and Private

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242

    Talking

    Hello!

    Can anyone tell me what's the difference between Public and Global declaration of variables/constants?
    I use VB for a few years, but I still don't know that...

    Zvonko

    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    Damn, I've mistyped the thread's title. It's Difference between Public and Global

    Sorry, guys!
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  4. #4
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Oh Global, I think global is the same as Public, it's only in VB5/6 for backwards compitability, it was used in VB4- I think
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  5. #5
    Guest
    An intrinsic object whose purpose is to collect global methods into one object.

    The Global object has no syntax. You call its methods directly.

    The Global object is never used directly, and cannot be created using the new operator. It is created when the scripting engine is initialized, thus making its methods and properties available immediately.

  6. #6
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    As far as their role in declaring variables, the difference between "Global" and "Public" is:
    (1) "Global" only remains in the language for backward compatibility. It was used in QBasic and earlier versions of VB.
    (2) "Global" can only be used in standard (.bas) modules, whereas "Public" can be used in standard modules, forms, classes, etc.
    (3) In standard modules, "Global" and "Public" have the same meaning.
    "It's cold gin time again ..."

    Check out my website here.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    Thanks guys, I was just courious...
    So it's the same if I declare variable as Global or as Public, although public is preferable...
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width