|
|
| |
|
|
| |
Intermediate |
| |
| |
Déjà Queue |
| |
You can use the technique for an "undo" menu/toolbar option. Use a collection instead of a listbox to reduce overhead. Support for both LIFO and FIFO is also included:
Public Queue As New Collection
Public Const Q_LIFO = 0
Public Const Q_FIFO = 1
Public Sub Enqueue(QueueItem As Variant)
Queue.Add QueueItem
End Sub
Public Function Dequeue(Optional Mode As Long) As Variant
Dim Position as Long
If Queue.Count > 0 Then
If Mode = Q_LIFO Then
Position = Queue.Count
Else
Position = 1
End If
Dequeue = Queue(Position)
Queue.Remove Position
Else
Dequeue = Null
End If
End Function
|
| |
Brian Ray
Rockford, Illinois |
| |
 |
| |
If you
have a hot tip and we publish it, we'll pay you $10. Be
sure to include a clear explanation of what the technique
does and why it's useful. If it includes code, limit it
to 20 lines if possible. Submit your tips here. |
|