From Xojo Documentation
|You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!|
Adds Value as the last element of the collection.
If Key is provided, it may be used to refer to the element using the Item property. Key defaults to the empty string.
The following code creates a collection, populates it with both string and numeric values, and displays each element in TextFields or a Canvas control (The picture "lois" has been added to the project). Note that a collection is much like a database record.
c.Add("Lois Lane", "Name")
TextField1.Text = c.Item("ID")
TextField2.Text = c.Item(2) // returns "Lois Lane"
TextField3.Text = c.Item("JobTitle")
TextField4.Text = c.Item("Salary")
Canvas1.Backdrop = c.Item("Picture")