I have 25 student name, and grade boxes that need to appear and disappear depending on how large the student number was given to start with.
So far i have had to use this if\then statement 25 times.
If txtStudentNum.Text = "" Then txtStudent1.Hide() txtGrade1.Hide() ElseIf txtStudentNum.Text > 0 Then txtStudent1.Show() txtGrade1.Show() End If
But i was Hoping I could do something like. Unfortunately this does not work because the name of the text box couldn't be declared with a variable.
for intX = 1 to 25 If txtStudentNum.Text = "" Then txtStudent(intX).Hide() txtGrade(intX).Hide() ElseIf txtStudentNum.Text > txtStudentNum.Text Then txtStudent(intX).Show() txtGrade(intX).Show() End If next
So, my question is, how would one go about cleaning up all of those if\then statements to clean up the clutter of the code?