home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmDateDemo
- BackColor = &H80000010&
- BorderStyle = 3 'Fixed Dialog
- Caption = "Date Demo"
- ClientHeight = 5175
- ClientLeft = 3120
- ClientTop = 2430
- ClientWidth = 6495
- Icon = "frmDateDemo.frx":0000
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 5175
- ScaleWidth = 6495
- ShowInTaskbar = 0 'False
- Begin VB.Frame Frame2
- Caption = "No Limit - First day of Week begins on Monday"
- Height = 2820
- Left = 315
- TabIndex = 15
- Top = 1425
- Width = 5880
- Begin VB.CommandButton Command11
- Caption = "Age: YY.MM"
- Height = 375
- Left = 3885
- TabIndex = 9
- Top = 960
- Width = 1860
- End
- Begin VB.CommandButton Command10
- Caption = "First Day of Year"
- Height = 375
- Left = 3885
- TabIndex = 11
- Top = 1395
- Width = 1860
- End
- Begin VB.CommandButton Command9
- Caption = "Is Leap Year?"
- Height = 375
- Left = 3885
- TabIndex = 0
- Top = 1860
- Width = 1860
- End
- Begin VB.CheckBox Check2
- Caption = "Show Week Numbers"
- Height = 465
- Left = 3900
- TabIndex = 20
- TabStop = 0 'False
- Top = 225
- Value = 1 'Checked
- Width = 1545
- End
- Begin VB.CommandButton Command8
- Caption = "Fill Combobox"
- Height = 330
- Left = 2580
- TabIndex = 10
- Top = 2400
- Width = 1680
- End
- Begin VB.ComboBox Combo1
- Height = 315
- Left = 855
- TabIndex = 18
- TabStop = 0 'False
- Text = "Combo1"
- Top = 2400
- Width = 1620
- End
- Begin VB.CommandButton Command7
- Caption = "End Of Week"
- Height = 375
- Left = 2010
- TabIndex = 8
- Top = 1860
- Width = 1860
- End
- Begin VB.CommandButton Command6
- Caption = "Beginning of Week"
- Height = 375
- Left = 120
- TabIndex = 5
- Top = 1860
- Width = 1860
- End
- Begin VB.CommandButton Command5
- Caption = "WeekDaysInMonth"
- Height = 375
- Left = 2010
- TabIndex = 7
- Top = 1395
- Width = 1860
- End
- Begin VB.CommandButton Command4
- Caption = "EndOfMonth"
- Height = 375
- Left = 120
- TabIndex = 4
- Top = 1395
- Width = 1860
- End
- Begin VB.CommandButton Command2
- Caption = "Week Number"
- Height = 375
- Left = 120
- TabIndex = 3
- Top = 960
- Width = 1860
- End
- Begin VB.CommandButton Command3
- Caption = "Date2Julian"
- Height = 375
- Left = 2010
- TabIndex = 6
- Top = 960
- Width = 1860
- End
- Begin VB.CommandButton Command1
- Height = 375
- Left = 3240
- MaskColor = &H000000FF&
- Picture = "frmDateDemo.frx":000C
- Style = 1 'Graphical
- TabIndex = 16
- TabStop = 0 'False
- ToolTipText = "Calendar"
- Top = 255
- UseMaskColor = -1 'True
- Width = 480
- End
- Begin VB.TextBox Text2
- Height = 315
- Left = 1125
- Locked = -1 'True
- TabIndex = 2
- Text = "Text2"
- ToolTipText = "+/- to change"
- Top = 255
- Width = 2010
- End
- Begin VB.Label Label2
- Caption = "Label2"
- Height = 255
- Left = 1155
- TabIndex = 17
- Top = 660
- Width = 2580
- End
- End
- Begin VB.Frame Frame1
- Caption = "Limit Year - First Day of week is Sunday"
- Height = 945
- Left = 300
- TabIndex = 12
- Top = 195
- Width = 5880
- Begin VB.CheckBox Check1
- Caption = "Show Week Numbers"
- Height = 465
- Left = 3915
- TabIndex = 19
- TabStop = 0 'False
- Top = 225
- Value = 1 'Checked
- Width = 1530
- End
- Begin VB.TextBox Text1
- Height = 315
- Left = 1125
- Locked = -1 'True
- TabIndex = 1
- Text = "Text1"
- ToolTipText = "+/- to change"
- Top = 255
- Width = 2010
- End
- Begin VB.CommandButton cmdDate
- Height = 375
- Left = 3240
- MaskColor = &H000000FF&
- Picture = "frmDateDemo.frx":05CA
- Style = 1 'Graphical
- TabIndex = 13
- TabStop = 0 'False
- ToolTipText = "Calendar"
- Top = 255
- UseMaskColor = -1 'True
- Width = 480
- End
- Begin VB.Label Label1
- Caption = "Label1"
- Height = 255
- Left = 1155
- TabIndex = 14
- Top = 660
- Width = 2580
- End
- End
- Begin VB.Label lblInfo
- Alignment = 2 'Center
- BackColor = &H00C0FFFF&
- Caption = "Press +/-- to change date"
- ForeColor = &H00000000&
- Height = 255
- Left = 315
- TabIndex = 22
- Top = 1155
- Visible = 0 'False
- Width = 5850
- End
- Begin VB.Label Label4
- Appearance = 0 'Flat
- BackColor = &H80000005&
- BorderStyle = 1 'Fixed Single
- Caption = "This will show off some of the different date calculations you can do with this class. You can check out the rest on your own."
- ForeColor = &H80000008&
- Height = 735
- Left = 510
- TabIndex = 21
- Top = 4380
- Width = 5550
- End
- Attribute VB_Name = "frmDateDemo"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim cDatef As New clsDateUtilities
- Dim FirstDay As Date
- Private Sub Check1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- lblInfo.Visible = False
- End Sub
- Private Sub Check2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- lblInfo.Visible = False
- End Sub
- Private Sub cmdDate_Click()
- If Check1.Value = vbChecked Then
- Call SelectCalDate(Text1, , False, True, cDatef.RetFirstDayOfYear(vbSunday))
- Else
- Call SelectCalDate(Text1, , False, False, cDatef.RetFirstDayOfYear(vbSunday))
- End If
- End Sub
- Private Sub cmdDate_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- lblInfo.Visible = False
- End Sub
- Private Sub Command1_Click()
- If Check2.Value = vbChecked Then
- Call SelectCalDate(Text2, , True, True, FirstDay)
- Else
- Call SelectCalDate(Text2, , True, False)
- End If
- End Sub
- Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- lblInfo.Visible = False
- End Sub
- Private Sub Command10_Click()
- Dim Y As Integer
- If Month(CDate(Text2)) < 12 Then
- Y = Year(CDate(Text2) + 6)
- Else
- Y = Year(CDate(Text2) - 6)
- End If
- Command10.Caption = cDatef.RetFirstDayOfYear(vbMonday, Y)
- End Sub
- Private Sub Command11_Click()
- Command11.Caption = "Age: " & cDatef.RetAge(CDate(Text2), Date)
- End Sub
- Private Sub Command2_Click()
- Command2.Caption = "Week: " & cDatef.RetWeekNumber(CDate(Text2), FirstDay)
- End Sub
- Private Sub Command3_Click()
- Command3.Caption = "Julian: " & cDatef.Date2Julian(CDate(Text2), FirstDay)
- End Sub
- Private Sub Command4_Click()
- Command4.Caption = "End: " & cDatef.EndOfMonth(CDate(Text2))
- End Sub
- Private Sub Command5_Click()
- Command5.Caption = "Mondays: " & cDatef.WeekDaysInMonth(CDate(Text2), vbMonday)
- End Sub
- Private Sub Command6_Click()
- Command6.Caption = "Wk Start: " & cDatef.RetBeginOfWeek(CDate(Text2), vbMonday)
- End Sub
- Private Sub Command7_Click()
- Command7.Caption = "Wk End: " & cDatef.RetBeginOfWeek(CDate(Text2), vbMonday) + 6
- End Sub
- Private Sub Command8_Click()
- cDatef.FillControlDates Combo1, FirstDay, True, True, Year(CDate(Text2))
- End Sub
- Private Sub Command9_Click()
- Command9.Caption = CStr(cDatef.IsLeapYear(Year(CDate(Text2))))
- End Sub
- Private Sub Form_Load()
- Text1 = Date
- Text2 = Date - 720
- End Sub
- Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- lblInfo.Visible = False
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- Set cDatef = Nothing
- Set frmDateDemo = Nothing
- End Sub
- Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- lblInfo.Visible = False
- End Sub
- Private Sub Frame2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- lblInfo.Visible = False
- End Sub
- Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- lblInfo.Visible = False
- End Sub
- Private Sub Label2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- lblInfo.Visible = False
- End Sub
- Private Sub Text1_Change()
- Label1 = Format(Text1, "dddd")
- End Sub
- Private Sub Text1_KeyPress(KeyAscii As Integer)
- cDatef.PlusKey Text1, KeyAscii, True, False, cDatef.RetFirstDayOfYear
- End Sub
- Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- lblInfo.Visible = True
- End Sub
- Private Sub Text2_Change()
- Dim Y As Integer
- If Month(CDate(Text2)) < 12 Then
- Y = Year(CDate(Text2) + 6)
- Else
- Y = Year(CDate(Text2) - 6)
- End If
- Label2 = Format(Text2, "dddd")
- FirstDay = cDatef.RetFirstDayOfYear(vbMonday, Y)
- End Sub
- Private Sub Text2_KeyPress(KeyAscii As Integer)
- cDatef.PlusKey Text2, KeyAscii, False, False
- End Sub
- Private Sub Text2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- lblInfo.Visible = True
- End Sub
-