Microsoft Visual Studio
Variables and properties exercise
Average difficulty

This Microsoft Visual Studio VARIABLES AND PROPERTIES exercise is provided to allow potential course delegates to assess their suitability for the Wise Owl VISUAL C# 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 a form for minimum spending on date

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

1) Make sure that you have Option Strict turned on in your project's compilation options (you might as well make life as hard as you can!).
2) Create a form called frmMoneySpent allowing someone to apply for a date, specifying their name and the amount they expect to be spent on them:
Exercise screen-shot 1223 So far, so easy
3) The dating agency sets a maximum of £100 for the first night's spend.  Attach code to the OK button so that if the amount entered is greater than this, the user will see an error message:
Exercise screen-shot 1224 You need to convert the text entered to a number, then find out if this exceeds 100
Training exercise hint To get this to work, use the syntax:  IF ... THEN / ELSE / END IF
4) If the user is within budget, on the other hand, display a welcoming message:
Exercise screen-shot 1225 Your message should include the user's name
5) Test your application works, then close the forms down.

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