Professional Documents
Culture Documents
DE#44 #$GGLQJ#0HQXV: 2emhfwlyhv
DE#44 #$GGLQJ#0HQXV: 2emhfwlyhv
/DE#44=#$GGLQJ#0HQXV
In this lab, you will add functionality to the loan project started in Lab 2. You will add a menu and a status
bar to the main form of the loan application. In an optional exercise, you can add a toolbar.
You can continue to work with the files you have already created, or you can use the files that have been
provided in the folder <install folder>\Labs\Lab11.
2EMHFWLYHV
After completing this lab, you will be able to:
To complete the exercises in this lab, you must have the required software. For detailed information about
the labs and setup for the labs, see Labs in this course.
The solution for this lab is located in the folder <install folder>\Labs\Lab11\Solution.
3UHUHTXLVLWHV
Before working on this lab, you should be familiar with the following:
([HUFLVHV
The following exercises provide practice working with the concepts and techniques covered in Chapter 11.
([HUFLVH#4=#$GGLQJ#D#0HQX
In this exercise, you will delete the command buttons on frmMain and call their functions from menu items
instead.
([HUFLVH#5=#$GGLQJ#D#6WDWXV#%DU
In this exercise, you will add a status bar to frmMain and post messages on the status bar instead of using
message boxes.
([HUFLVH#6#+2SWLRQDO,=#$GGLQJ#D#7RROEDU
In this exercise, you will add a toolbar with two buttons to frmMain.
Lab 11: Adding Menus
295 ([HUFLVH#4=#$GGLQJ#D#0HQX
In this exercise, you will delete the command buttons on frmMain and call their functions from menu items
instead.
Like command buttons, a menu provides the user with a way to invoke actions in an application.
Notes
Page 70
Lab 11: Adding Menus
Notes
Page 71
Lab 11: Adding Menus
295 ([HUFLVH#5=#$GGLQJ#D#6WDWXV#%DU
In this exercise, you will add a status bar to frmMain and post messages on the status bar instead of using
message boxes.
Note If Microsoft Windows Common Controls does not appear in the list of available controls,
ensure that the Selected Items Only option is not selected and that the Controls tab is selected in the
Components dialog box.
1 Key msg
Style 0 - sbrText
Autosize 1 - sbrSpring
2 Key time
Alignment 1 - sbrCenter
Style 5 - sbrTime
Autosize 2 - sbrContents
Notes
Page 72
Lab 11: Adding Menus
b. Replace the message box showing the results of the MonthlyPayment function with a message in
the status bar:
sbrLoan.Panels("msg").Text = "Monthly payment: " & _
Format(dblMonthly, "currency")
… 2. In the ShowTotal procedure, replace each message box with a message in the status bar.
… 3. Save and test your work.
Notes
Page 73
Lab 11: Adding Menus
295 ([HUFLVH#6#+2SWLRQDO,=#$GGLQJ#D#7RROEDU
In this exercise, you will add a toolbar with two buttons to frmMain.
Note The image list is invisible when the application runs, so don’t worry about its placement.
… 2. In the Visual Basic Properties window, set the image list’s Name property to imlLoan.
… 3. Open the Image List control's Property Pages dialog box by selecting the Custom property of the
status bar in the Properties window.
… 4. Click the 16 x 16 option button on the General tab.
… 5. Move to the Images tab and insert two pictures that have been provided on this CD-ROM in the
following folders:
<install folder>\Labs\Lab11\exit.bmp
<install folder>\Labs\Lab11\month.bmp
… 6. After inserting the pictures, click OK.
Note The image on a toolbar button should be 16 x 16 pixels. You can use the Visual Basic Image Editor
to create these images. In a complete installation of Visual Basic, the Image Editor, Imagedit, is found in
the COMMON\TOOLS\VB\IMAGEDIT folder of the Microsoft Visual Studio® 98 CD-ROM.
Notes
Page 74
Lab 11: Adding Menus
Notes
Page 75
This page intentionally left blank.