Return to Snippet

Revision: 24176
at February 22, 2010 16:23 by heatherk


Initial Code
' This is a First in First Out structure for strings

Option Explicit
Private sColl As Collection
Private curIndex As Integer
Private Sub Class_Initialize()
    Set sColl = New Collection
    curIndex = 0
End Sub
Private Sub Class_Terminate()
    Set sColl = Nothing
End Sub
Public Property Get Count() As Long
    Count = sColl.Count
End Property
Public Property Get NextValue() As String
    NextValue = CStr(sColl.item(sColl.Count))
End Property
Public Sub Push(ByVal value As String)
    sColl.Add value
End Sub
Public Function Pop() As String
    Dim poppedval As String
    poppedval = CStr(sColl.item(sColl.Count))
    sColl.Remove (sColl.Count)
    Pop = poppedval
End Function
Public Sub Clear()
    'clears all elements
    Do Until sColl.Count = 0
        sColl.Remove (0)
    Loop
End Sub

Initial URL


Initial Description
String FIFO class used in a production VB6 application.

Initial Title
StringQueue collection object

Initial Tags


Initial Language
Visual Basic