Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Global Variable NOT!!!
Message
 
To
09/04/2006 21:00:59
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01111807
Message ID:
01112589
Views:
10
> 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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform