Microsoft Developer
Validating forms exercise
Average difficulty

This Microsoft Developer VALIDATING FORMS exercise is provided to allow potential course delegates to assess their suitability for the Wise Owl VISUAL BASIC 2005 WINDOWS FORMS course only, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

Exercise: Using ErrorProvider controls to check age filled in

A full answer to this exercise is provided as part of the training course!

1) Download the files needed to start this exercise: exercise-650.zip (and click here if you experience any problems unzipping this file after downloading it).
2) Add the form in the above folder to your application, or work with a copy of this form that you have already imported or created.
3) Add an ErrorProvider control to your form.
4) Attach code to the Validating event of each of the two text boxes so that:
  • if the length of the name is zero, you show an error next to it
  • if the age isn't an integer, you show an error next to it
5) Test out your validation:
Exercise screen-shot 1243 This shows that you need to be careful when displaying errors next to textbox controls in panels
6) Check that your application works, then close down its forms.

Thank you for showing an interest in this Visual Basic 2005 Windows Forms training course! As mentioned above, full answers to this and other exercises are provided on the course. On all Wise Owl scheduled courses delegates can take away these model answers (together with their own efforts!) on a free USB stick.

All content copyright Wise Owl Business Solutions Ltd 2008.  All rights reserved..