Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array problem in EXE

Status
Not open for further replies.

Ashr

Programmer
Apr 19, 2005
46
0
0
HU
I declared an array in a form screen by "DIMENSION arparasat(54)" which I put it in the Load Method of the form , the fillup of the array I put in onther Method by " arparasat[1]='Bit' "etc' , I created a Combobox/Pupup & chose the option of " Values from an array " , when runnig the form as APP it's working fine , when creating stand alone EXE and running it I get a error massage " ARPARASAT is not an array " , I don't realy know what's the problem.

Thank's
 

Try creating an array property in the form, rather than a regular array, or try making your array a public array.
Code:
Public array arparasat[54]


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
To expand on Mike's answer, the problem is that things you define in Load or Init go out of scope when the method ends.

Making the array a form property is the right way to do this. To do so, choose Form | New Property from the menu. Enter the array name followed by [1] and click Add.

When you refer to the array in the form, you need to use:

ThisForm.aMyArray

substituting the actual name of your array.

Tamar
 
Thank u guy's , I used the public first & it's working ok , TamarGranor answer is very detailed & helped me to learen something new.
 
Declaring variables public is a bad idea. It's much better to add custome properties.

Tamar
 
Tamar is right on with her advice. It is a few more lines of code to do this properly the first time, but the savings in debugging problems later will make it worth the effort.

Plus you do not need to clean up and release the variable after you are done, the form does that for you.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top