Good day!
I want to save input into an Array, and then show this information.
To enter data I am using a textBox. After "Enter" it should save info into the Array.
If textBox is empty, it should show information. I would like to use a textbox too, that shows all the Array after pressing Enter.
textbox on the Form: txtInput, txtOutput
I have the following code, but I am not able to get it work:
I want to save input into an Array, and then show this information.
To enter data I am using a textBox. After "Enter" it should save info into the Array.
If textBox is empty, it should show information. I would like to use a textbox too, that shows all the Array after pressing Enter.
textbox on the Form: txtInput, txtOutput
I have the following code, but I am not able to get it work:
Code:
Option Compare Database
Public Sub Form_Load()
Dim Data(10) As Integer
Dim i As Integer
Dim j As Integer
Dim bExit As Boolean
Const MaxElem As Integer = 10
Const MaxArray As Integer = MaxElem - 1
i = 0
j = 0
bExit = False
'------------------------------
'initialize array
'------------------------------
For i = 0 To 10
Data(i) = 0
Next
i = 0
'------------------------------
'save data into array
'------------------------------
While ((i <= MaxArray) And (bExit = False))
Data(i) = Me.txtInput
i = i + 1
If (Len(Me.txtInput) <> 0) Then
bExit = True
End If
Wend
'------------------------------
'show on textBox arrays data
'------------------------------
While j < i
Me.txtOutput = Data(j)
j = j + 1
Wend
End Sub