Beruflich Dokumente
Kultur Dokumente
/DE#6=#:RUNLQJ#ZLWK#)RUPV
In this lab, you will add functionality to the loan project started in Lab 2. You will create a shell for the main
application form. From that shell, you will load the logon form, and then show the main form of the
application. You can continue to work with the files you created in Lab 2, or you can use the files provided
for you in the <install folder>\Labs\Lab03 folder.
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 <install folder>\Labs\Lab03\Solution folder.
3UHUHTXLVLWHV
There are no prerequisites for this lab.
([HUFLVHV
The following exercises provide practice working with the concepts covered in Chapter 3.
([HUFLVH#4=#$GGLQJ#WKH#0DLQ#)RUP
In this exercise, you will add a form, frmMain, to the project. This form will eventually become the main
form of the application. For now, frmMain will be used to load frmLogon.
([HUFLVH#5=#&ORVLQJ#)RUPV#DQG#(QGLQJ#DQ#$SSOLFDWLRQ
In this exercise, you will add code to close the logon form when OK or Cancel is clicked, and to end the
application when Done is clicked.
([HUFLVH#6=#$GGLQJ#D#0HVVDJH#%R[
In this exercise, you will add code to the main form that verifies that the user wants to exit the application.
You'll also set a property on the logon form to center it when it is shown.
Lab 3: Working with Forms
97 ([HUFLVH#4=#$GGLQJ#WKH#0DLQ#)RUP
In this exercise, you will add a form, frmMain, to the project. This form will eventually become the main
form of the application. For now, frmMain will be used to load frmLogon.
(Name) frmMain
Caption Loan Payment
Estimate
BorderStyle 1 - Fixed Single
MinButton True
(Name) cmdDone
Caption &Done
Cancel True
Notes
Page 16
Lab 3: Working with Forms
End Sub
… 2. Within this procedure, add a line of code to display the logon form modally.
To see an example of how your code should look, click this icon.
(CD-ROM displays a hint.)
Notes
Page 17
Lab 3: Working with Forms
97 ([HUFLVH#5=#&ORVLQJ#)RUPV#DQG#(QGLQJ#DQ#$SSOLFDWLRQ
In this exercise, you will add code to close the logon form when OK or Cancel is clicked, and to end the
application when the Done button of the Main form is clicked.
X End the application when the user clicks Cancel on frmLogon, or Done on frmMain
… 1. Add code to the Click event procedure of the cmdCancel button on frmLogon to end the application:
End
… 2. Add code to the Click event procedure of the cmdDone button on frmMain to unload the form:
Unload frmMain
… 3. Add code to the Unload event procedure of frmMain to end the application:
End
Notes
Page 18
Lab 3: Working with Forms
97 ([HUFLVH#6=#$GGLQJ#D#0HVVDJH#%R[
In this exercise, you will add code to the main form that verifies that the user wants to exit the application.
You'll also set a property on the logon form to center it when it is shown.
Instead of just ending the application in the Unload event of the main form, you can enable the user to
choose between closing the application or continuing to use it.
Notes
Page 19
This page intentionally left blank.