Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does FoxPro 6.0 handle collections? - Again
Message
 
To
22/09/1998 18:27:29
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00139271
Message ID:
00142526
Views:
27
I finally got it to work! Here is a simple example. First create an Active-X DLL in Visual Basic with the following for the Class Module:

Public Function Create() As Variant
Dim loCollection As New Collection

loCollection.Add "One", "String"
loCollection.Add "1", "Character"
loCollection.Add 1, "Integer"
loCollection.Add #1/1/98#, "Date"
loCollection.Add 1.12, "Float"

Set Create = loCollection
End Function

Under the projects properties, name the project Test and the Class Module Tools. Afterwards, compile to a DLL.

In Visual FoxPro, do the following:

oTest = CREATEOBJECT("Test.Tools")
oCollection = loTest.Create()

? oTest.Count && Returns 5
? oCollection.Item(1) && Returns "One"
? oCollection.Item("String") && Returns "One"
= oCollection.Add(DATETIME(), "Time") && Adds current date and time
= oCollection.Remove(1) && Removes key "One"
? oCollection.Item(1) && Returns 1

Thanks for your help!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform