by Chrysovalantis Anastasiades (5 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 20th June 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Simple way to start learning collections
API Declarations
'Create two command buttons (Command1 , Command2)
'Change the Caption of the first command button to - All -
'and the Caption of the second command button to - One -
Dim eng_alphabet As New Collection
Dim i As Integer
eng_alphabet.Add ("A")
eng_alphabet.Add ("B")
eng_alphabet.Add ("C")
eng_alphabet.Add ("D")
eng_alphabet.Add ("E")
eng_alphabet.Add ("F")
eng_alphabet.Add ("G")
eng_alphabet.Add ("H")
eng_alphabet.Add ("I")
eng_alphabet.Add ("J")
eng_alphabet.Add ("K")
eng_alphabet.Add ("L")
eng_alphabet.Add ("M")
eng_alphabet.Add ("N")
eng_alphabet.Add ("O")
eng_alphabet.Add ("P")
eng_alphabet.Add ("Q")
eng_alphabet.Add ("R")
eng_alphabet.Add ("S")
eng_alphabet.Add ("T")
eng_alphabet.Add ("U")
eng_alphabet.Add ("V")
eng_alphabet.Add ("W")
eng_alphabet.Add ("X")
eng_alphabet.Add ("Y")
eng_alphabet.Add ("Z")
End Sub
Private Sub Command1_Click()
Cls
For i = 1 To 26
Print "The letter with the number " & i & " in the english alphabet is the letter : " & eng_alphabet.Item(i)
Next i
End Sub
Private Sub Command2_Click()
Cls
i = InputBox("Insert the number of the Letter", "")
Print "The letter with the number " & i & " in the english alphabet is the letter : " & eng_alphabet.Item(i)
End Sub