In this tutorial we created a simple quiz program using a control array of custom controls. There are at least three very cool aspects to this approach.

1. By storing the correct answers in the responseField’s rightAnswer property we never have to load this information from a file on the hard disk.

2. Using 2 properties and adding a little bit of code to answerField’s TextChanged event we were able to have it keep track of correct answers as the user entered answers in each array member.

3. Because the responseFields were in an array we could loop throught them using their index numbers to get the overall score.

The programming problems solved elegantly by this approach include:
– keeping track of the correct answers
– evaluating user responses
– totalling correct answers

If we imagine a quiz with dozens or even hundreds of questions and answers the advantages of this type of approach are even more obvious.