home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- AutoRedraw = -1 'True
- BorderStyle = 1 'Fixed Single
- Caption = "Count Down"
- ClientHeight = 2460
- ClientLeft = 3270
- ClientTop = 1635
- ClientWidth = 2055
- ControlBox = 0 'False
- Height = 2865
- Icon = "FORM1.frx":0000
- Left = 3210
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 2460
- ScaleWidth = 2055
- Top = 1290
- Width = 2175
- Begin VB.Timer Timer1
- Enabled = 0 'False
- Left = 0
- Top = 3720
- End
- Begin VB.CommandButton Command4
- Caption = "Exit"
- Height = 375
- Left = 240
- TabIndex = 8
- Top = 2040
- Width = 1575
- End
- Begin VB.CommandButton Command3
- Caption = "Reset"
- Enabled = 0 'False
- Height = 375
- Left = 1440
- TabIndex = 7
- Top = 1560
- Width = 615
- End
- Begin VB.CommandButton Command2
- Caption = "Pause"
- Height = 375
- Left = 720
- TabIndex = 6
- Top = 1560
- Width = 615
- End
- Begin VB.CommandButton Command1
- Caption = "Start"
- Height = 375
- Left = 0
- TabIndex = 5
- Top = 1560
- Width = 615
- End
- Begin VB.TextBox Text3
- Alignment = 2 'Center
- Height = 285
- Left = 1560
- MultiLine = -1 'True
- TabIndex = 4
- Top = 240
- Width = 375
- End
- Begin VB.TextBox Text2
- Alignment = 2 'Center
- Height = 285
- Left = 840
- MultiLine = -1 'True
- TabIndex = 3
- Top = 240
- Width = 375
- End
- Begin VB.TextBox Text1
- Alignment = 2 'Center
- Height = 285
- Left = 120
- MultiLine = -1 'True
- TabIndex = 2
- Top = 240
- Width = 375
- End
- Begin VB.Label Label6
- Alignment = 2 'Center
- Caption = "Sec"
- Height = 255
- Left = 1560
- TabIndex = 12
- Top = 600
- Width = 375
- End
- Begin VB.Label Label5
- Alignment = 2 'Center
- Caption = "Min"
- Height = 255
- Left = 840
- TabIndex = 11
- Top = 600
- Width = 375
- End
- Begin VB.Label Label4
- Alignment = 2 'Center
- Caption = "Hrs"
- Height = 255
- Left = 120
- TabIndex = 10
- Top = 600
- Width = 375
- End
- Begin VB.Label Label3
- Alignment = 2 'Center
- Caption = "Time Remaining"
- Height = 255
- Left = 240
- TabIndex = 9
- Top = 840
- Width = 1575
- End
- Begin VB.Label Label2
- Alignment = 2 'Center
- Caption = "Select Time"
- Height = 255
- Left = 120
- TabIndex = 1
- Top = 0
- Width = 1695
- End
- Begin VB.Label Label1
- Alignment = 2 'Center
- BackColor = &H0000FFFF&
- Caption = "00:00:00"
- BeginProperty Font
- name = "Arial"
- charset = 1
- weight = 700
- size = 14.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H000000FF&
- Height = 375
- Left = 240
- TabIndex = 0
- Top = 1080
- Width = 1575
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- 'Count down alarm program
- 'Written by Ed Hammond
- 'Ham & Ham Services
- 'hamham@harborside.com
- 'If you improve this program please send me a copy.
- 'Modified by Uddip Mitra
- 'Interstellar Software Cell
- 'indioman@hotmail.com
- 'Dimention the variables used in the program.
- Dim Hours As Integer
- Dim Minutes As Integer
- Dim Seconds As Integer
- Dim Time As Date
- Private Sub Mydisplay()
- 'This code is common to all three text boxes so I
- 'put it in it's own sub.
- 'Extract the numbers from the text boxes by using
- 'the Val() statement.
- Hours = Val(Text1.Text)
- Minutes = Val(Text2.Text)
- Seconds = Val(Text3.Text)
- 'Convert variables to time format
- Time = TimeSerial(Hours, Minutes, Seconds)
- 'Display the converted time variable in label 1
- Label1.Caption = Format$(Time, "hh") & ":" & Format$(Time, "nn") & ":" & Format$(Time, "ss")
- End Sub
- Private Sub Command1_Click()
- 'Start button - turn on timer and disable reset
- 'button
- Timer1.Enabled = True
- Command3.Enabled = False
- End Sub
- Private Sub Command2_Click()
- 'Pause button - temporarily stop timer and enable
- 'reset button. You can restart countdown by clicking
- 'the start button. Or reset the time by clicking
- 'the reset button.
- Timer1.Enabled = False
- Command3.Enabled = True
- End Sub
- Private Sub Command3_Click()
- 'Reset button - reset all varibles and text boxes
- 'to nothting.
- Hours = 0
- Minutes = 0
- Seconds = 0
- Time = 0
- Text1.Text = " "
- Text2.Text = " "
- Text3.Text = " "
- Text1.SetFocus 'put curser in the hour text box
- End Sub
- Private Sub Command4_Click()
- 'Exit button - end program and clear varibles
- End
- End Sub
- Private Sub Form_Load()
- 'Center form on screen.
- Form1.Top = (Screen.Height - Form1.Height) / 2
- Form1.Left = (Screen.Width - Form1.Width) / 2
- 'Set timer interval and varibles
- Timer1.Interval = 1000
- Hours = 0
- Minutes = 0
- Seconds = 0
- Time = 0
- End Sub
- Private Sub Text1_Change()
- 'Call Mydisplay sub to display text box data
- Mydisplay
- End Sub
- Private Sub Text2_Change()
- 'Call Mydisplay sub to display text box data
- Mydisplay
- End Sub
- Private Sub Text3_Change()
- 'Call Mydisplay sub to display text box data
- Mydisplay
- End Sub
- Private Sub Timer1_Timer()
- 'Count down loop
- Timer1.Enabled = False
- If (Format$(Time, "hh") & ":" & Format$(Time, "nn") & ":" & Format$(Time, "ss")) <> "00:00:00" Then 'Counter to continue loop until 0
- Time = DateAdd("s", -1, Time)
- Label1.Visible = False
- Label1.Caption = Format$(Time, "hh") & ":" & Format$(Time, "nn") & ":" & Format$(Time, "ss")
- Label1.Visible = True
- Timer1.Enabled = True
- Else
- 'Turn off timer, set off alarm, and enable reset.
- Timer1.Enabled = False
- Beep
- Beep
- Command3.Enabled = True
- End If
- End Sub
-