Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Collections
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP1
Database:
Visual FoxPro
Divers
Thread ID:
01040090
Message ID:
01040101
Vues:
21
>Can you please give me a code sample to create a multi column collection.
>
>Thanks, Jitendra Shahani

A very simple sample, and there are many ways to do something like this, this is just what I can come up this late :)
loTestCollection	= CREATEOBJECT('Collection')
WITH loTestCollection as Collection
	.Add(newTestObject('Name_001', 'One'), 'Key_001')
	.Add(newTestObject('Name_002', 'Two'), 'Key_002')
	.Add(newTestObject('Name_003', 'Three'), 'Key_003')
	.Add(newTestObject('Name_004', 'Four'), 'Key_004')
ENDWITH

FOR EACH loTestObject IN loTestCollection
	WITH loTestObject
		? .Class, .Name, .Value
	ENDWITH
ENDFOR


FUNCTION newTestObject(tcName, tcValue)

LOCAL loTest

loTest		= CREATEOBJECT('Empty')

ADDPROPERTY(loTest, 'Class', 'TestObject')
ADDPROPERTY(loTest, 'Name', tcName)
ADDPROPERTY(loTest, 'Value', tcValue)

RETURN loTest
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform