Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Global Variable NOT!!!
Message
 
À
09/04/2006 21:00:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01111807
Message ID:
01112589
Vues:
12
> However, when I load the program on a new WinXP machine, my program complains that it can't find variable "glTable".
>
> I thought global variables were available throughout an entire program once delared PUBLIC.
>
> Any ideas?

My First thought are the 3 situations where PUBLIC variables are not visible after they're declared:

1) If the var gets RELEASE'd
PUBLIC gnVersion
gnVersion = 1.0
RELEASE gnVersion
xx = gnVersion  && -- Throws "var not found"
2) If a PRIVATE statement masks it:
PUBLIC gnVersion
gnVersion = 1.0
PRIVATE ALL LIKE gn*
xx = gnVersion  && -- Throws "var not found"
3) If the public is passed as a parameter:
PUBLIC gnVersion
gnVersion = 1.0
DO Whatever WITH gnVersion
xx=Whatever( gnVersion )
   
PROCEDURE Whatever
PARAMETER tnAny
if tnAny=gnVersion  && -- Throws "var not found"
  RETURN .T.
ENDIF
RETURN .F.
So, I'd suspect #3 is happening in a path of execution that happens on the "other" computer which doesn't execute on the development computer because of it being a different environment (certain files/folders not existing, etc)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform