Microsoft Visual Basic
Attaching code to forms exercise
Average difficulty

This Microsoft Visual Basic ATTACHING CODE TO FORMS exercise is provided to allow potential course delegates to assess their suitability for the Wise Owl ACCESS VISUAL BASIC course only, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

Exercise: Changing control properties

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

1) Download the files needed to start this exercise: exercise-252.zip (and click here if you experience any problems unzipping this file after downloading it).
2) Open the form called Form Code Examples (see below):
Exercise screen-shot 396 Write code to make the buttons do what they say they will!
3) Use the hints below as a guide:
  • A label has a Left property measured in twips - 567 twips = 1 centimetre!
  • A label has a ForeColor and a BackColor property.  Use variables to store the current colours and then swap them.
  • A form has a Section collection (one of the few collections which doesn't end with an 's').  The main sections are Section(0) - (Detail), Section(1) - (Form Header) and Section(2) - (Form Footer).  Each member has a Height property.
4) Close the form saving the changes.

Thank you for showing an interest in this Access Visual Basic 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.