Visual Basic | Testing conditions exercise | Use conditions to check a form is correctly filled in

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.

Software ==> Visual Basic  (46 exercises)
Version ==> Any version of VB
Topic ==> Testing conditions  (2 exercises)
Level ==> Average difficulty
Subject ==> Visual Basic training
Before you can do this exercise, you'll need to download and unzip this file (if you have any problems doing this, click here for help).

You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Press CTRL + D to add the file called frmApplication.vb from the above folder into your project (or right click on the project and choose to add it as an existing item). 

Change your project's properties to make this the default form for your project.  When you run your project, you should see this:

Dating agency application form it isn't, but it's a start ...

Add validation code to check that each text and combo box is filled in, that the age text boxes contain integers, and that each age is between sensible values (infants and centenarians don't date much ...).

If you find a text box with an invalid value, display an error message, use Focus() to leave the cursor in it and exit your subroutine.

Still got time and energy?  Add a message at the end to announce your choice to the world:

Final message box

An example of what you should see (would a fox really seek a cougar?).


That's it!  Close everything down and give yourself a pat on the back. 

You can unzip this file to see the answers to this exercise, although please remember this is for your personal use only.
This page has 0 threads Add post