Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
395 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
| Software ==> | Visual Basic (46 exercises) |
| Topic ==> | Form validation (3 exercises) |
| Level ==> | Relatively easy |
| Subject ==> | Visual Basic training |
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
Add the existing form in the folder shown above into your project. When you run your application, you should see this:

You should call the ValidateChildren method from the APPLY button
Attach code to the Validating event of the txtName textbox, so that a message appears if you leave the name blank:

Display a message if a user leaves the name blank
Repeat this trick for the txtAge field, this time checking also that the age entered is a whole number (one way to do this is with :Try ... Catch ... End Try, within which you can attempt to convert the txtAge field's text property to an integer.

What you should see if you enter an invalid age (or none at all)
Finally, add code to the Age field's Validated event so that the age is increased by 10 years after it has been checked:

Reflecting the fact that everyone lies on dating agency application forms ...
You should now see that the Validated event fires whether you change the value in their Age text box or not. How might you stop your age increasing by 10 years every time a user leaves the Age text box?
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2026. All Rights Reserved.