Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Whats a collection
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00418796
Message ID:
00418827
Vues:
28
>I am working with a DLL created in VB and one of the parameters is a collection. I know it consist of 5 fields(strings)What Im wondering is when I call the Dll function would I drop the contents into a cursor and how would I return the contents after manipulating them. Is a collection the same as a cursor?

A collection is a property that contains a list of elements. Each element may be a simple data type, such as a string, or could be an object, with member properties, methods and collecions of it's own. VFP can traverse a collection using the FOR EACH syntax.

Let's assume we have an object named GroceryStore, instanced by the ProgID Grocery.Store. In a GroceryStore object, there is a property called StoreName that tells us which store to examine, a bunch of methods, and a collection called veggies, a colection of veggy objects. Each veggy object has properties Name, color, number_onhand and price. You can examine the veggies in your object by:
oStore = CREATEOBJ('Grocery.Store')
oStore.StoreName = "Ed's Fine Junk Foods"
FOR EACH veggy IN oStore.Veggies
   ? veggy.name, veggy.color, veggy.number_onhand, veggy.price
ENDFOR
You can have multile collections in an object; an object within a collection may be referencable by a name or it's instance number, a decision made by the person creating the object. There is no guarentee that any collection will contain any members, or a fixed limit on the number of members in collection (in most cases, the collection will have a Count property; in our case, oStore.Veggies.Count normally will tell you how many members it contains.) Each member of a collectwill be the same kind of thing; IOW, a collection of veggy objects would not also contain meat objects if meat objects behaved differently (different properties or methods.)
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform