Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Cronometro - Form1.frm

Form1.frm

Caricato da: Natamas
Scarica il programma completo

  1. Dim mil As Byte, sec As Byte, min As Byte, ore As Byte, az As Byte, cron As Long
  2.  
  3. Private Sub avv_Click()
  4. If az = 1 Then
  5. Timer1.Enabled = True
  6. avv.Caption = "Pausa"
  7. az = 2
  8. ElseIf az = 2 Then
  9. Timer1.Enabled = False
  10. avv.Caption = "Avvia"
  11. az = 1
  12. End If
  13. End Sub
  14.  
  15. Private Sub Form_Load()
  16. az = 1
  17. Call azzera
  18. End Sub
  19.  
  20. Private Sub Form_Unload(Cancel As Integer)
  21. MsgBox App.Title & " è stato realizzato Giuseppe Cazzato" & Chr(13) & "Per info: giuseppec87@libero.it", vbInformation, App.Title
  22. Unload Me
  23. End
  24. End Sub
  25.  
  26. Private Sub res_Click()
  27. Timer1.Enabled = False
  28. az = 1
  29. avv.Caption = "Avvia"
  30. Call azzera
  31. End Sub
  32.  
  33. Sub azzera()
  34. mil = 0
  35. sec = 0
  36. min = 0
  37. ore = 0
  38. cron = 0
  39. Me.Caption = App.Title & " " & App.Major & "." & App.Minor
  40. mil_t.Caption = mil
  41. sec_t.Caption = sec
  42. min_t.Caption = min
  43. ore_t.Caption = ore
  44. Call Controlla
  45. End Sub
  46.  
  47. Sub Controlla()
  48. 'Controllo millisecondi
  49. If mil_t.Caption = "0" Then mil_t.Caption = "00"
  50. If mil_t.Caption = "1" Then mil_t.Caption = "01"
  51. If mil_t.Caption = "2" Then mil_t.Caption = "02"
  52. If mil_t.Caption = "3" Then mil_t.Caption = "03"
  53. If mil_t.Caption = "4" Then mil_t.Caption = "04"
  54. If mil_t.Caption = "5" Then mil_t.Caption = "05"
  55. If mil_t.Caption = "6" Then mil_t.Caption = "06"
  56. If mil_t.Caption = "7" Then mil_t.Caption = "07"
  57. If mil_t.Caption = "8" Then mil_t.Caption = "08"
  58. If mil_t.Caption = "9" Then mil_t.Caption = "09"
  59. 'Controllo secondi
  60. If sec_t.Caption = "0" Then sec_t.Caption = "00"
  61. If sec_t.Caption = "1" Then sec_t.Caption = "01"
  62. If sec_t.Caption = "2" Then sec_t.Caption = "02"
  63. If sec_t.Caption = "3" Then sec_t.Caption = "03"
  64. If sec_t.Caption = "4" Then sec_t.Caption = "04"
  65. If sec_t.Caption = "5" Then sec_t.Caption = "05"
  66. If sec_t.Caption = "6" Then sec_t.Caption = "06"
  67. If sec_t.Caption = "7" Then sec_t.Caption = "07"
  68. If sec_t.Caption = "8" Then sec_t.Caption = "08"
  69. If sec_t.Caption = "9" Then sec_t.Caption = "09"
  70. 'Controllo minuti
  71. If min_t.Caption = "0" Then min_t.Caption = "00"
  72. If min_t.Caption = "1" Then min_t.Caption = "01"
  73. If min_t.Caption = "2" Then min_t.Caption = "02"
  74. If min_t.Caption = "3" Then min_t.Caption = "03"
  75. If min_t.Caption = "4" Then min_t.Caption = "04"
  76. If min_t.Caption = "5" Then min_t.Caption = "05"
  77. If min_t.Caption = "6" Then min_t.Caption = "06"
  78. If min_t.Caption = "7" Then min_t.Caption = "07"
  79. If min_t.Caption = "8" Then min_t.Caption = "08"
  80. If min_t.Caption = "9" Then min_t.Caption = "09"
  81. 'Controllo ore
  82. If ore_t.Caption = "0" Then ore_t.Caption = "00"
  83. If ore_t.Caption = "1" Then ore_t.Caption = "01"
  84. If ore_t.Caption = "2" Then ore_t.Caption = "02"
  85. If ore_t.Caption = "3" Then ore_t.Caption = "03"
  86. If ore_t.Caption = "4" Then ore_t.Caption = "04"
  87. If ore_t.Caption = "5" Then ore_t.Caption = "05"
  88. If ore_t.Caption = "6" Then ore_t.Caption = "06"
  89. If ore_t.Caption = "7" Then ore_t.Caption = "07"
  90. If ore_t.Caption = "8" Then ore_t.Caption = "08"
  91. If ore_t.Caption = "9" Then ore_t.Caption = "09"
  92. 'Controllo finito
  93. End Sub
  94.  
  95. Private Sub Timer1_Timer()
  96. Call Cronometro
  97. Call Controlla
  98. End Sub
  99.  
  100. Sub Cronometro()
  101. 'inizio millisecondi
  102. mil = mil + 1
  103. If mil = 100 Then
  104. sec = sec + 1
  105. mil = 0
  106. mil_t.Caption = mil
  107. sec_t.Caption = sec
  108. 'inizio secondi
  109. If sec = 60 Then
  110. min = min + 1
  111. sec = 0
  112. sec_t.Caption = sec
  113. min_t.Caption = min
  114. 'inizio minuti
  115. If min = 60 Then
  116. ore = ore + 1
  117. min = 0
  118. min_t.Caption = min
  119. ore_t.Caption = ore
  120. 'inizio ore
  121. If ore = 24 Then
  122. ore = 0
  123. ore_t.Caption = ore
  124. 'inizio cron
  125. Dim vol As String, gio As String
  126. cron = cron + 1
  127. vol = " volte"
  128. gio = " giorni"
  129. If cron = 1 Then
  130. vol = " volta"
  131. gio = " giorno"
  132. End If
  133. Me.Caption = App.Title & " " & App.Major & "." & App.Minor & " ( Cronometro azzerato " & cron & vol & ", cioé son passati " & cron & gio & " )"
  134. 'fine cron
  135. End If
  136. 'fine ore
  137. Else
  138. min_t.Caption = min
  139. End If
  140. 'fine minuti
  141. Else
  142. sec_t.Caption = sec
  143. End If
  144. 'fine secondi
  145. Else
  146. mil_t.Caption = mil
  147. End If
  148. 'fine millisecondi
  149. End Sub