Advertisement
Guest User

stackoverflow

a guest
Sep 2nd, 2014
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  Private Sub tmrNow_Tick(sender As Object, e As EventArgs) Handles tmrNow.Tick
  2.         curT = DateTime.Now
  3.         txtNow.Text = curT.ToString("hh:mm")
  4.         '1st Class
  5.        If curT.Hour = 7 AndAlso (curT.Minute >= 0 And curT.Minute <= 45) Then
  6.             lblPeriod.Text = "1st Period "
  7.             txtPassed.Text = curT.ToString("mm:ss")
  8.             '2nd Class
  9.        ElseIf (curT.Hour = 7 And curT.Minute > 50) Or (curT.Hour = 8 And curT.Minute <= 30) Then
  10.             lblPeriod.Text = "2 nd Period "
  11.             Dim first As DateTime = CDate("07:50")
  12.             Dim second As DateTime = CDate("08:35")
  13.             Dim current As DateTime
  14.             current = DateTime.Now
  15.             Dim diffBefore As TimeSpan = current - first
  16.             Dim diffAfter As TimeSpan = second - current
  17.             txtPassed.Text = diffBefore.ToString("mm\:ss")
  18.             txtLeft.Text = diffAfter.ToString("mm\:ss")
  19.             '3rd Class
  20.        ElseIf (curT.Hour = 8 And curT.Minute > 40) Or (curT.Hour = 9 And curT.Minute <= 25) Then
  21.             lblPeriod.Text = "3 rd Period "
  22.             '4th Class
  23.        ElseIf (curT.Hour = 9 And curT.Minute > 40) Or (curT.Hour = 10 And curT.Minute <= 30) Then
  24.             lblPeriod.Text = "4 th Period "
  25.             '5th Class
  26.        ElseIf (curT.Hour = 10 And curT.Minute > 35) Or (curT.Hour = 11 And curT.Minute <= 20) Then
  27.             lblPeriod.Text = "5 th Period "
  28.             '6th Class
  29.        ElseIf (curT.Hour = 11 And curT.Minute > 25) Or (curT.Hour = 12 And curT.Minute <= 10) Then
  30.             lblPeriod.Text = "6 th Period "
  31.         Else
  32.             lblPeriod.Text = "Free time"
  33.         End If
  34.  
  35.      
  36.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement