dawkirst
New member
- Joined
- May 25, 2006
- Messages
- 2
- Programming Experience
- Beginner
Dear VB.NET programmers,
My form has two textboxes, and three buttons. With the first textbox and button the user can set the array's highest sub script. With the second textbox and button, the user can enter an X amount of "student marks" that needs to be read into the array. The third button should take the sum of all the array elements and print it to the screen.
My array isn't populating as it should: it makes all my first entries as zero, and take only the last entry into account -- what is wrong with my code? Sorry if it's a bit messy.
I have also attached the file.
Thanks ahead!
My form has two textboxes, and three buttons. With the first textbox and button the user can set the array's highest sub script. With the second textbox and button, the user can enter an X amount of "student marks" that needs to be read into the array. The third button should take the sum of all the array elements and print it to the screen.
My array isn't populating as it should: it makes all my first entries as zero, and take only the last entry into account -- what is wrong with my code? Sorry if it's a bit messy.
I have also attached the file.
Thanks ahead!
VB.NET:
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
ReDim intMarks(intCounter)
Dim i As Integer = 0
For i = j To intCounter - 1
intMarks(i) = Convert.ToInt16(Me.txtMarks.Text)
Next
j = j + 1
If j >= intCounter Then
MessageBox.Show("Array full")
End If