Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tell if variable exists?
Message
From
10/08/2001 03:49:44
Peter Brama
West Pointe Enterprises
Detroit, Michigan, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Tell if variable exists?
Miscellaneous
Thread ID:
00542155
Message ID:
00542155
Views:
80
How can I tell if a variable already exists? I am writing a routine to read an INI file and create variables for each item within. I need to have it create an array (if applicable) and originally intended to give the "variable" the same name in the INI with a new value. What I want to do is test to see if the variable (or array) already exists and if it does, redimension it increasing it's size by 1

The problem I ran into is on the "first" instance of the variable. I get a #12 error, variable not found, with every function I can think to use to test and process this change.

To clarify (it's late!!!)....

My INI would look like this:

** Program Variables **
mydatapath=c:\test

** Array values
myarr=element1
myarr=element2
myarr=element3


What I would like to do is when the first myarr value is read, the Arr at the end of the variable name tells me it's an array. I need to redimension the array increasing by 1 for each time the same variable name is read. The problem is, if I use a routine like this....

dimension myarr[alen(myarr)+1]

this will work for everything EXCEPT the first instance of the array. I get the variable doesn't exist when I try it...

HELP!!!!
Peter Brama
West Pointe Enterprises

VFP is getting easier but STILL alot to learn!!
Next
Reply
Map
View

Click here to load this message in the networking platform