Microsoft Visual Basic
Form validation exercise
Relatively easy

This Microsoft Visual Basic FORM VALIDATION exercise is provided to allow potential course delegates to assess their suitability for the Wise Owl ASP.NET 2.0 USING VB course only, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

Exercise: Drink order form with validation controls

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

1) Create a form allowing you to input a drink, and say how many ice cubes you want with it:
Exercise screen-shot 1616 A teetotal version of the form working - when you place your order, the label at the bottom displays it back to you
2) Add as many validation controls as you feel are appropriate (or have time for) - here are some sugggestions:
  • A RequiredFieldValidator to check that the drink is filled in
  • Another RequiredFieldValidator to check the number of ice cubes is filled in
  • A CompareValidator to check that the number of ice cubes is an integer
  • A RangeValidator to check that the number of ice cubes is between 0 and 4
  • A ValidationSummary displaying all of the errors found
3) If you leave all of the form fields blank and try to place an order, this is what you might see:
Exercise screen-shot 1617 Your validation controls may look very different from this
4) Save and close down any open files.

Thank you for showing an interest in this ASP.NET 2.0 using VB 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 � Wise Owl Business Solutions Ltd 2007.  All rights reserved.  Design by Branches.