home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / vbdates / dates.bas < prev    next >
Encoding:
BASIC Source File  |  1995-10-23  |  2.0 KB  |  97 lines

  1. Global ADay As Integer
  2. Global Theyear As Integer
  3. Global TheMonth As Integer
  4. Global ThisMonth As Integer
  5. Global Months(1 To 12) As String
  6. Global TheDay As Integer
  7. Global StartDay As Integer
  8. Global dow  As Integer
  9. Global WeekDays(1 To 7) As String
  10. Global Jan As Integer
  11. Global Feb As Integer
  12. Global Mar As Integer
  13. Global Apr As Integer
  14. Global May As Integer
  15. Global Jun As Integer
  16. Global Jul As Integer
  17. Global Aug As Integer
  18. Global Sep As Integer
  19. Global Octr As Integer
  20. Global Nov As Integer
  21. Global Dec As Integer
  22.  
  23. Global Const Black = &H0&
  24. Global Const Red = &HFF&
  25. Global Const Green = &HFF00&
  26. Global Const YELLOW = &HFFFF&
  27. Global Const Blue = &HFF0000
  28. Global Const MAGENTA = &HFF00FF
  29. Global Const CYAN = &HFFFF00
  30. Global Const WHITE = &HFFFFFF
  31. Global Const Gray = &HC0C0C0
  32.  
  33. Sub FillMonth ()
  34. dow = Weekday(DateSerial(Theyear, TheMonth, 1))
  35. ADay = Day(Now)
  36. Startblock = dow - 1
  37. Select Case TheMonth
  38. Case 1
  39. DaysInMonth = Jan
  40. Case 2
  41. DaysInMonth = Feb
  42. Case 3
  43. DaysInMonth = Mar
  44. Case 4
  45. DaysInMonth = Apr
  46. Case 5
  47. DaysInMonth = May
  48. Case 6
  49. DaysInMonth = Jun
  50. Case 7
  51. DaysInMonth = Jul
  52. Case 8
  53. DaysInMonth = Aug
  54. Case 9
  55. DaysInMonth = Sep
  56. Case 10
  57. DaysInMonth = Octr
  58. Case 11
  59. DaysInMonth = Nov
  60. Case 12
  61. DaysInMonth = Dec
  62. End Select
  63.  
  64. ' Reset the calendar buttons
  65.  
  66. For i = 0 To 36
  67. 'Calendar.DayButton(i).Caption = ""
  68. Calendar.DayButton(i).Visible = False
  69. Calendar.DayButton(i).Font3D = 0
  70. Calendar.DayButton(i).ForeColor = Black
  71. Next i
  72.  
  73.  
  74. For i = Startblock To ((DaysInMonth) + (Startblock - 1))
  75. Calendar.DayButton(i).Visible = True
  76. Calendar.DayButton(i).Caption = (i - (Startblock - 1))
  77. Next i
  78.  
  79. Calendar.MonthBox.Caption = Months(TheMonth) + Str$(Theyear)
  80.  
  81.  
  82. If TheMonth = Month(Now) Then
  83. Calendar.DayButton(Day(Now) + Startblock - 1).ForeColor = Blue
  84.  
  85. End If
  86.  
  87. Calendar.DayButton(0).ForeColor = Red
  88. Calendar.DayButton(7).ForeColor = Red
  89. Calendar.DayButton(14).ForeColor = Red
  90. Calendar.DayButton(21).ForeColor = Red
  91. Calendar.DayButton(28).ForeColor = Red
  92. Calendar.DayButton(35).ForeColor = Red
  93.  
  94.  
  95. End Sub
  96.  
  97.