Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy to Array (Only if it feels like it?)
Message
From
15/04/1998 16:48:43
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Copy to Array (Only if it feels like it?)
Miscellaneous
Thread ID:
00092298
Message ID:
00092298
Views:
62
Hi all,

The way the system is currently set up, there are several list boxes and combo boxes that use a table directly for their record sources. This is fine in principle, but in practice those forms tend to go a bit wonky at times. Things like a record showing up multiple times, or not at all. Sometimes the list changes as you navigate up and down it!

I've found that using arrays as rowsources is much slicker and more reliable. The problem is getting the info from the table to the array.

If I do this:

copy to array a1 field fldname
display memory like a1

Then it works fine and I get an array filled with those fields like it's supposed to.

But if I do:

public a1(20)

(knowing that there are 20 records)

And then do the same code, I get a1(1) with the first field, and the rest are .f.

So just don't declare the array ahead of time, right? Well, usually. But sometimes VFP doesn't like that. In one place, it comes up with an error saying a1 doesn't exist. It goes ahead and does the copying anyway, but it's annoying having that error message come up. More worrysome is when VFP decides to kick up a fuss about it not existing and won't load up the form.

So is there anyway to declare an array first and then "copy to" it? I've done a bunch of testing in the command window, and no matter what I try, if I declare it first, it doesn't copy properly.

This bugged me in version 3. I was hoping it was fixed in 5. Guess not.

Thanks,
Next
Reply
Map
View

Click here to load this message in the networking platform