General information
Category:
Forms & Form designer
Title:
Array Scoping for Display
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only