Guest User

Untitled

a guest
Aug 14th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. detect system date change, visual basics
  2. Dim today As Integer
  3. today = Format(Now, "dd")
  4.  
  5. Dim iMinute As Integer 'The "current" minute
  6.  
  7. Private Sub Form_Load()
  8. 'Initialize
  9. iMinute = Format(Now, "n") 'Get the current time as minute
  10. Timer1.Interval = 1000 'Set interval = 1000 milliseconds
  11. Timer1.Enabled = True 'Start Timer1 (my Timer)
  12. End Sub
  13.  
  14. Private Sub Timer1_Timer()
  15. 'This happens when the given Interval has passed (in this case, every second)
  16. Dim iMinuteNow As Integer
  17.  
  18. iMinuteNow = Format(Now, "n")
  19. If iMinuteNow <> iMinute Then
  20. MsgBox "You are now in a new minute"
  21. iMinute = iMinuteNow
  22. End If
  23. End Sub
Add Comment
Please, Sign In to add comment