Image

Imagerhiahnnon wrote in Imagevbdev

Dynamic Arrays (Please help yet again)

Could someone please help?

Here's what I have to do:

1. Code PrintGradesButton to display the grade list in MessageLabel.
2. Code AddGradeButton to:
a)pop up with an input box and allow the user to enter the new grade.
intGrade = CInt(InputBox("Enter grade:"))
b) increase the size of the array by 1.
c) store the new grade in the array.

This is what I did but I'm not sure if it's right.

Private Grades() As Int16 'declare array on top of the form

In the AddGradeButton I have this code:

dim intGrade as int16
dim intValue as int16
intGrade = CInt(InputBox("Enter grade:"))
intGrade = GetUpperBound(+1)
ReDim Preserve Grade(intValue)
Grade(intValue) = intGrade

Does this look right to you?