Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Array Scoping for Display
Message
From
01/07/2002 16:01:13
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Array Scoping for Display
Miscellaneous
Thread ID:
00674117
Message ID:
00674117
Views:
65
Hello,
Quick question, sorry if it's basic but, starting to learn.

I need to display two arrays in two list boxes on a form. Currently I am trying to use the following code inside of either the load or init event of the form, it doesn't seem to matter on use, neither way works.

m.temp=cgdrive+oform.cbssrchordno
IF DIRECTORY(temp)
IF FILE(temp+'seller')
DIMENSION aseller[10,1]
m.lcPath=cgdrive+oform.cbssrchordno+'seller'
FOR i=1 TO 10
aseller(i,1)=""
next
USE(m.lcPath)
COPY TO ARRAY aseller
ELSE
DIMENSION aseller[10,1]
FOR i=1 TO 10
aseller(i,1)=""
next
ENDIF
IF FILE(temp+'buyer')
DIMENSION abuyer[10,1]
m.lcPath=cgdrive+oform.cbssrchordno+'buyer'
FOR i=1 TO 10
abuyer(i,1)=""
next
USE(m.lcPath)
COPY TO ARRAY abuyer
ELSE
DIMENSION abuyer[10,1]
FOR i=1 TO 10
abuyer(i,1)=""
next
ENDIF
ELSE
MD &temp
DIMENSION aseller[10,1]
DIMENSION abuyer[10,1]
FOR i=1 TO 10
aseller(i,1)=""
next
FOR i=1 TO 10
abuyer(i,1)=""
next
ENDIF

After reaching the last ENDIF the arrays disappear. I know that the arrays would be scoped as private but, because they are in the form itself wouldn't it work? I can only get this to work if I declare the arrays public. Could someone explain this to me please?

Thank you,

Troy
Next
Reply
Map
View

Click here to load this message in the networking platform