Thursday, July 8, 2010

My Visual Basic 6.0 (Chapter 01-Ex1.1)


+Exercise 1.1:
HI! In this exercises illustrates about start and Stop watch...


+Setting Properties:

-form:
Name: frmStopwatch
Caption: Stopwatch Application

-Commands:
Command 1:
Name: cmdStartTime
Caption: &Start Timing
Command 2:
Name: cmdEndTime
Caption: &End Timing
Command 3:
Name: cmdExit
Caption: &Exit

-Labels:
Label1:
Name: lblStartTime (optional)
Caption: Start Time
Label2:
Name: lblEnd Time (optional)
Caption: End Time
Label3:
Name: lblElapsedTime (optional)
Caption: Elapsed Time

-Text Boxs:
Text box1:
Name: txtStartTime
Text: " " // Leave it blank..!
Text box2:
Name: txtEndTime
Text: " " // Leave it blank..!
Text box3:
Name: txtElapsedTime
Text: " " // Leave it blank..!

+Attaching Codes:
Option Explicit
Dim StartTime as variant
Dim EndTime as variant
Dim ElapsedTime as Variant
------------------------------------
Private Sub cmdEndTime_Click()
EndTime = Now
txtEndTime = Format ( EndTime, "hh:mm:ss AMPM")
ElapsedTime = EndTime - StartTime
txtElapsedTime = Format (ElapsedTime, "hh:mm:ss")
End Sub

Private Sub cmdStartTime_Click()
StartTime = Now
txtStartTime = Format ( StartTime, "hh:mm:ss AMPM")
End Sub

Private Sub cmdExit_Click()
End
End Sub

No comments:

Post a Comment