I am trying to create a one-dimensional array without size from text entered into a textbox. I then use the redim statement to resize the array.
I have tried two different approaches without success. The first was setting the textbox up as the array:
Dim txtScore() As TextBox
Dim iScoreCount As Integer
For ReDim Preserve txtScore(iScoreCount)
iScoreCount += 1
Next
The second was setting up the array and trying to get data from the textbox to the array:
Dim dScore As Decimal
Dim iScoreCount As Integer
For dScore(iScoreCount) = txtScore.Text 'this is a syntax error
iScoreCount += 1
Next
I was able to get the first entry into the textbox into the array, but could not get anything further into it. I used the following to check:
lblScoreCount.Text = iScoreCount
I would get a "1" in the label, but when I tried to enter another number into the textbox, nothing would happen.
Any ideas on how to get the loop to work, or am I making this much harder than it has to be?
I have tried two different approaches without success. The first was setting the textbox up as the array:
Dim txtScore() As TextBox
Dim iScoreCount As Integer
For ReDim Preserve txtScore(iScoreCount)
iScoreCount += 1
Next
The second was setting up the array and trying to get data from the textbox to the array:
Dim dScore As Decimal
Dim iScoreCount As Integer
For dScore(iScoreCount) = txtScore.Text 'this is a syntax error
iScoreCount += 1
Next
I was able to get the first entry into the textbox into the array, but could not get anything further into it. I used the following to check:
lblScoreCount.Text = iScoreCount
I would get a "1" in the label, but when I tried to enter another number into the textbox, nothing would happen.
Any ideas on how to get the loop to work, or am I making this much harder than it has to be?