Code from lab Nov. 11

The code below relied on one command button.

Option Explicit
Const MAX As Integer = 3
Private a() As Integer

Private Sub Command1_Click()
    Dim inputStr As String
    Dim number As Integer
    Dim counter As Integer
    
    ReDim a(0 To MAX)
    counter = 0
    inputStr = InputBox("Enter val (nothing to quit)")
    
    Do Until inputStr = ""
        number = Val(inputStr)
        counter = counter + 1
        
        a(counter) = number
        
        If counter >= UBound(a) Then
            ReDim Preserve a(0 To UBound(a) * 2)
        End If
        
        inputStr = InputBox("Enter val (nothing to quit)")
    Loop
    
    a(0) = counter
    
    Call printArray
End Sub

Sub printArray()
    Dim i As Integer
    
    Print "Size of array is "; UBound(a)
    Print "valid data items: "; a(0)
    For i = 1 To a(0)
        Print a(i)
    Next i
    
End Sub