Reference > DSTStylesCollection Object > DSTStylesCollection Methods > Add Method (DSTStylesCollection) |
Add Method (DSTStylesCollection)
Adds or inserts a style object in the style collection and returns a reference to the created object.The style collection is 1-based. A new style object can easily be added by using the property page at design time, and using the Add method at run time. The following example shows how Daylight Savings Time (DST) styles can be added and inserted.
object.Add ([Index], Key, [Name])
index is an optional variant: an integer specifying the position where you want to insert the style object. If you do not specify an index, the style object is added to the end of the styles collection.
key is a required, unique string that identifies the created style object. Use this key to retrieve a specific object.
name is an optional variant: a name or description of the created object. This is equivalent to setting the Name property in the new object.
A reference to the newly created style object where appropriate, otherwise none.
Example
Dim objTZ As New TDBTZoneX6Lib.TDBTZoneX
Dim DSTS As TDBTZoneX6Lib.DSTStyle
' Add DST styles to the collection
objTZ.DSTStyles.Add , "CN", "China Beijing"
objTZ.DSTStyles.Add , "IN", "Bombay, New Delhi"
objTZ.DSTStyles.Add , "BS", "Brasilia"
' Insert a DST style in the second element
Set DSTS = objTZ.DSTStyles.Add (2, "IS", "Israel")
The above example first adds three DST styles to the collection, and then inserts another style in the 2nd element whose key is "IS".
The nth weekday of a month can be retrieved and added to the HolidayStyles collection using the EnumWeekdays of the TDBDateX object. For details please refer to the TDBDateX chapter.
See Also