Results 1 to 3 of 3

Thread: Global vs Public

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    Mobile, AL
    Posts
    16

    Post

    Is there a difference between defining a variable as Global or defining it as Public?
    Ex.
    Global giEmpNbr as integer
    Public giEmpNbr as integer

    I think Public has replaced Global but are there any differences when concerned with memory?

    Should I be concerned with deallocating memory in VB? Or does it just happen automatically?


  2. #2
    New Member
    Join Date
    Jan 2000
    Location
    Blackpool
    Posts
    14

    Post

    Best using classes and storing variables as a property of that class and creating an instance of that class to reference the property. Object Orientated programming is the way. If you need any help just say

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    You are correct about Public replacing Global, but both are supported. I don't think there is any memory differences but I could be wrong. Yes, you should be concerned about deallocating memory in VB. While most of it is done automatically, you should set any objects (recordsets, forms, etc) that you create at run time = Nothing.

    ------------------
    Marty

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