Microsoft Visual Basic
Menus and toolbars exercise
Average difficulty

This Microsoft Visual Basic MENUS AND TOOLBARS 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: Creating and coding a menu, toolbar and status bar

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

1) Download the files needed to start this exercise: exercise-652.zip (and click here if you experience any problems unzipping this file after downloading it).
2) Add the form in the folder above into your project (or use a previous version that you have been working with).
3) Add a MenuStrip, ToolStrip, StatusStrip and ContextMenu to your form so that the form works as shown below (you may find the property shown below useful):
Exercise screen-shot 1280 When you click in a textbox, the menu, toolbar, right mouse menu and status bar all react sensibly
4) Here is what the menu would look like for our example:
Exercise screen-shot 1281 The current colour option is disabled and checked
5) You may find it useful to write the following property of the form, so that you can find out which the currently selected textbox is (note that if the user is not on a text box, this routine will return Nothing - which you can test for):
Exercise screen-shot 1282 TryCast attempts to convert an object to a specific data type, and returns NOTHING if this fails
6) When you have everything working perfectly (or more likely, when you run out of time), close everything down!

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..