Property Stack Class

NthFromTop

Return the value of the Nth item from the top of the stack, The item at the top of the stack is numbered 1 (one).

Signature (Visual Basic / VBA)

Public Property Get NthFromTop( _
    ByVal vElement As Long _
    ) As Variant

Code Examples

    Assuming
       stkTemp.StringView() = "(Top) 4444, 333, 22, 1 (Bottom)"
    for example
       Dim varTemp As Variant
       varTemp = stkTemp.NthFromTop(2)
    leaves
       varTemp = 333
    Assuming
       stkTemp.StringView() = "(Top) 44, 33, 22, 11 (Bottom)"
    for example
       stkTemp.Item(2) = 555
    leaves
       stkTemp.StringView() = "(Top) 44, 555, 22, 11 (Bottom)"
    Assuming
       stkTemp.StringView() = "(Top) 44, 33, 22, 11 (Bottom)"
       Dim objTemp As Object
       Set objTemp = Nothing
    for example
       Set stkTemp.Item(2) = objTemp
Public Property Let NthFromTop( _
      ByVal vElement As Long _
    , ByVal vValue As Variant _
    )
Public Property Set NthFromTop( _
      ByVal vElement As Long _
    , ByVal vValue As Variant _
    )

Parameters

Parameter Description
vElement Number of the item whose value should be returned. vElement must be between 1 and Count otherwise this Property returns an Empty value (a Variant whose VarType is vbEmpty).
vElement Number of the item whose value should be set to vValue. vElement must be between 1 and Count otherwise this procedure silently does nothing.
vElement Number of the item whose value should be set to vValue. vElement must be between 1 and Count otherwise this procedure silently does nothing.

Return Value

Return value is the value of the stack item. It can be any type of Variant value (vbString, numeric, vbDate, vbObject, vbArray, etc.).

Notes & Version History

v1.3 BugFix This Property Get Function has been fixed to support the retrieval of Object and DataObject type Values. Set the value of the Nth item from the top of the stack,
Note The item at the top of the stack is numbered 1 (one).
vValue The value to which the specified item should be set. vValue can be any type of Variant value (vbString, numeric, vbDate, vbArray, etc.) except an Object or DataObject.
v1.3 BugFix The corresponding Property Set Subroutine supports the storage of Object and DataObject type Values. Set the value of the Nth item from the top of the stack,
Note The item at the top of the stack is numbered 1 (one).
vValue The Object or DataObject value to which the specified item should be set.
v1.3 BugFix This new Property Set Subroutine has been added to support the storage of Object and DataObject type Values.