Archie
June 14th, 2001, 12:53 PM
Does anyone know what changes I need to make to the code below so that it does not give me an error that says "For each control variable must be Variant or Object. Thank you for your help.
Dim myColl As New Collection
Private Sub cmdAdd_Click()
If Len(txtInput) > 0 Then
myColl.Add txtInput
txtInput = ""
End If
End Sub
Private Sub cmdDisplay_Click()
Dim item As String
lstOutput.Clear
For Each item In myColl
lstOutput.AddItem item
Next item
End Sub
Private Sub Form_Load()
Set myColl = New Collection
End Sub
Archie Kantzavelos
Dim myColl As New Collection
Private Sub cmdAdd_Click()
If Len(txtInput) > 0 Then
myColl.Add txtInput
txtInput = ""
End If
End Sub
Private Sub cmdDisplay_Click()
Dim item As String
lstOutput.Clear
For Each item In myColl
lstOutput.AddItem item
Next item
End Sub
Private Sub Form_Load()
Set myColl = New Collection
End Sub
Archie Kantzavelos