Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement