Extra Credit: Program 1
Extra
Credit: Program 1
- Make the program so that the Calculate command button can be activated by pressing the
Enter
key.
- Make the program so that the Calculate command button
can be activated by pressing the Alt-C
keys.
- Put ToolTip text on the Calculate
command button
to tell what it is used for. You can find this
property in the property window.
- Add a Quit command button
to the form. Make the program so that this
command button
can
be activated by pressing the Alt-Q keys or the
Esc key. To make the
Esc key work set the
Cancel property
to true in the property window. The code for the Quit Command button is one line,
"Unload
Me", this will
unload the form
and stop the program.
- Use the Format$ function
to format your answer to two decimal places. See the notes in Chapter 2 on the
Format$ function
or click on the live links found on this page to get Microsoft's explanation
of the Format$ function.
- Rename all the controls in your project using the prefixes outlined in
Chapter 2.
- Put the following code into the GotFocus
and LostFocus
event of each of the three Input TextBoxes.
Remember to change the control name from Text1 to Text2 and Text3 in the code
for the 2nd and 3rd textboxes.
GotFocus
code for Text1:
Text1.ForeColor =
vbRed
'set Text to Red
Text1.FontBold = True
'Boldface
Text1.BackColor =
vbYellow 'set TextBox to Yellow
LostFocus
code for Text1:
Text1.ForeColor =
vbBlack
'set Text to Black
Text1.FontBold = False
'not bold
Text1.BackColor =
vbWhite
'set TextBox to White
- To get credit for your extra credit work you must underline or highlight the properties and code
involved and put the letters EC to the right side of your work !
| Assignments | Outputs | Requirements |