User Interfaces - assignment practice
Back to Main Page
We have now covered all of the basic coding tools, and it is time to look forward to the assignment for this unit.

The task below contains all of the basic coding components needed for the assignment task, even though the task is a slightly simpler one!

Please ensure that you
complete the following task, noting the comments added to the code - it will be a very useful rehearsal for you final program.


In future units on the National Diploma, we will cover the use of buttons, menus and boxes which make the user interface much simpler to use. For now, we need to set out our simple forms and input boxes so that the user is guided through the program clearly.



The program is a simple converter that allows the user to convert a measurement from inches to centimetres (or vice versa). It shows how VB can be used to give a clear and well-set out user interface, using spacing, placing and properly formatted input boxes.


The algorithm works as follows:

- The user is asked which conversion they want to do (ins - > cms or cms -> ins)
- They enter 1 to convert from centimetres to inches
- They enter 2 to convert from inches to centimetres
- They are asked to re-enter 1 or 2 if they do not do so correctly
- They are then asked to enter an amount to convert
- The program displays the converted amount with an appropriate message



Task 1

Read through the code below to ensure that you understand what it does - read the
comments if you are unsure.
Task 2

Run the program and test it for both conversion options. Remember than 1 inch is roughly 2.5 cms, so 10 cms should be roughly 4 inches.
How did you think the user interface worked? Were the instructions clear? Would an inexperienced PC user be able to use the program?

One problem that you may have had is that the input boxes appeared and covered the user instructions. This can be cured by moving the instruction form to a different place on the screen.

To do this, make sure that the Form Layout window is displayed:

Click View menu -> Form Layout window

Move your form by clicking on Form1 and dragging it to the
top centre of the screen. Re-run your program and experiment
until the interface is clear.
Task 3

The user was also helped by clear instructions on the form and in the input boxes. You will notice that the input boxes had:
- a name in the top bar explaining their function
- clear text instructions telling the user what to do

To do this, use the following format:

Amount = InputBox("Please enter the value in centimetres", "Enter amount")

The first message in "" marks appears as text IN the box
The second message in "" marks appears as the title in the top bar of the box
Remember to use ""'s and separate the 2 messages with a comma.

The use of instructions on a form and boxes with clear instructions guides the user through the operation of the program.
Remember that your final assignment program will need to have CLEAR on-screen instructions for an inexperienced user!


End of Tasks
Hosted by www.Geocities.ws

1