PDA

Click to See Complete Forum and Search --> : Global vs Public


richaa
Jan 12th, 2000, 12:06 AM
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?

SteFlitII
Jan 12th, 2000, 12:10 AM
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

MartinLiss
Jan 12th, 2000, 01:41 AM
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