| |
Exercise 1
- Using the database Properties in the Unit 2 folder, you created in
Lesson 1 in the DPS folder. Create a new form, do not attach a database to it.
- Change the Caption of the form to display, Lesson 5 - Review
- Turn Record Selectors, Navigation Buttons and Dividing Lines to No
- Turn Auto Centre to Yes.
- Change the Width to 2 inches.
- Change Scroll Bars to none
- Save the form with the Name of Lesson5Exercise1.
- Create the following form. Make the Caption of the form read Fahrenheit.
- Name the textbox txtTemp, change it's label to read Temperature
- Name the label under the textbox, lblTemperature. Change its caption to read Converted
Temperature is:
- There are actually two command buttons. One named cmdCelsius, which has a
caption of Convert to Celsius. You can see this button in the picture below.
- The second button is in the exact same location and size of cmdCelsius. This second
button has the name, cmdFahr, it has a caption of Convert to Fahrenheit.
The reason you can not see it, is that its' Visible property has been set to No.
- The user will then type a value for Fahrenheit degrees into the text box. When the user
clicks the button, the correct number of degrees Celsius is shown in the lblTemperature
label as shown below:
- Also notice that the caption for the form changed to Celsius and the cmdFahr
button is visible and the cmdCelsius button is not visible.
- When the cmdFahr button is clicked it will do the conversion from Celsius
degrees into Fahrenheit.
- The conversion formulas are:
Celsius = (5/9) * (Fahrenheit - 32)
Fahrenheit = (9/5) * (Celsius + 32)
- Now when the result is shown in the label, the form caption changes back to Fahrenheit
and the cmdCelsius button becomes visible and the cmdFahr button is not
visible. This continues until the user closes the form.
|