Function Stack Class

Remove

Remove the value on the top of the stack (if vElement is 0), or remove the Nth element from the bottom of the stack (if vElement is >0). Return True upon success and False upon failure.

Signature (Visual Basic / VBA)

Public Function Remove( _
    ByVal vElement As Long _
    ) As Boolean

Code Example

    Assuming
       stkTemp.StringView() = "(Top) 4, 3, 2, 1 (Bottom)"
    for example
       stkTemp.Remove(0) = True
    leaves
       stkTemp.StringView() = "(Top) 3, 2, 1 (Bottom)"

Parameters

Parameter Description
vElement Number of the stack element to be removed, counting from the bottom of the stack starting at one. If vElement is 0 (zero), then this function removes the element on the top of the stack.

Return Value

Function returns True upon success. The function does nothing and returns False if the stack is empty.

Notes & Version History

Note Remove(0) is the same as Drop (1)
v1.3 BugFix This Function has been fixed to support the removal of elements from Stacks containing Object and/or DataObject type Values.