6 Here we go on creating a design job like the following picture.
- Using the "Comm
and Button" control to draw the three sequence command buttons, Command1, Command2 and Command3.
- Using the "Label" control to draw the six sequence labels, Label1,
Label2, Label3, Label4, Label5 and Label6
7 Click on "Form1", we can see its properties, rename it with "frmStopWatch" (frm is a pefix which comes from "form"). And change its caption to "Stop Watch Application".
8 Click on "Command1", yes we are about to specify the properties of this object. Rename it with "cmdStart" (cmd is a prefix which comes from "command button") and also refill its caption with "&Start Timing" (& is a prefix of the key letter that a user can press on this key together with the "alt" key instead of click on this command button).
9 Do it the same way as the previous step.
10 Do it the same way as the previous step.
11 Change only the captions of Label1, Label2 and
Label3 according to the following picture.
12 Change the properties of the other last three labels, "Label4", "Label5" and "Label6" by renaming them to "lblStart", "lblEnd" and "lblElapsed" and erase their captions until they are blank.
13 Now we have just already designed and configured all of related objects, the next step of us is coding our program. Let's click on the menu-bar at the "View" command tab, then select the "Code" sub-command, the view-code window will show up. Yes, we are going to enter our source codes of our application here.
14 The first set of source codes is about the declarations. There will be the "(General)" at the left-top of the view-code window and the "(Declarations)" at the right-top. We have to type four lines of our following source codes.
15 This step is about attaching o
ur source code to a control object. The "cmdStart" is a command button we are going to attach the source code. Let's double click on this command button, yes, this action could bring us to a module or subprogram that could be driven by an event, _click ( ), that means this subprogram could work when this command button was clicked on.
What is about this source code? It begins with assigning the recent time value (Now) to the variable "StartTime". Then the method "Caption" stipulates that the label "lblStart" can show up data from the variable "startTime" with the "hh:mm:ss:" format.
17 This is the end of application with the only amazing word "End"
18 Congratulation to our tough project!. This is the output of our input and process. Yes, it is the "Stop Watch Application" of us.