home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Work_with_547982122002.psc / frmDateDemo.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2002-02-12  |  11.9 KB  |  347 lines

  1. VERSION 5.00
  2. Begin VB.Form frmDateDemo 
  3.    BackColor       =   &H80000010&
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Date Demo"
  6.    ClientHeight    =   5175
  7.    ClientLeft      =   3120
  8.    ClientTop       =   2430
  9.    ClientWidth     =   6495
  10.    Icon            =   "frmDateDemo.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   5175
  16.    ScaleWidth      =   6495
  17.    ShowInTaskbar   =   0   'False
  18.    Begin VB.Frame Frame2 
  19.       Caption         =   "No Limit - First day of Week begins on Monday"
  20.       Height          =   2820
  21.       Left            =   315
  22.       TabIndex        =   15
  23.       Top             =   1425
  24.       Width           =   5880
  25.       Begin VB.CommandButton Command11 
  26.          Caption         =   "Age: YY.MM"
  27.          Height          =   375
  28.          Left            =   3885
  29.          TabIndex        =   9
  30.          Top             =   960
  31.          Width           =   1860
  32.       End
  33.       Begin VB.CommandButton Command10 
  34.          Caption         =   "First Day of Year"
  35.          Height          =   375
  36.          Left            =   3885
  37.          TabIndex        =   11
  38.          Top             =   1395
  39.          Width           =   1860
  40.       End
  41.       Begin VB.CommandButton Command9 
  42.          Caption         =   "Is Leap Year?"
  43.          Height          =   375
  44.          Left            =   3885
  45.          TabIndex        =   0
  46.          Top             =   1860
  47.          Width           =   1860
  48.       End
  49.       Begin VB.CheckBox Check2 
  50.          Caption         =   "Show Week Numbers"
  51.          Height          =   465
  52.          Left            =   3900
  53.          TabIndex        =   20
  54.          TabStop         =   0   'False
  55.          Top             =   225
  56.          Value           =   1  'Checked
  57.          Width           =   1545
  58.       End
  59.       Begin VB.CommandButton Command8 
  60.          Caption         =   "Fill Combobox"
  61.          Height          =   330
  62.          Left            =   2580
  63.          TabIndex        =   10
  64.          Top             =   2400
  65.          Width           =   1680
  66.       End
  67.       Begin VB.ComboBox Combo1 
  68.          Height          =   315
  69.          Left            =   855
  70.          TabIndex        =   18
  71.          TabStop         =   0   'False
  72.          Text            =   "Combo1"
  73.          Top             =   2400
  74.          Width           =   1620
  75.       End
  76.       Begin VB.CommandButton Command7 
  77.          Caption         =   "End Of Week"
  78.          Height          =   375
  79.          Left            =   2010
  80.          TabIndex        =   8
  81.          Top             =   1860
  82.          Width           =   1860
  83.       End
  84.       Begin VB.CommandButton Command6 
  85.          Caption         =   "Beginning of Week"
  86.          Height          =   375
  87.          Left            =   120
  88.          TabIndex        =   5
  89.          Top             =   1860
  90.          Width           =   1860
  91.       End
  92.       Begin VB.CommandButton Command5 
  93.          Caption         =   "WeekDaysInMonth"
  94.          Height          =   375
  95.          Left            =   2010
  96.          TabIndex        =   7
  97.          Top             =   1395
  98.          Width           =   1860
  99.       End
  100.       Begin VB.CommandButton Command4 
  101.          Caption         =   "EndOfMonth"
  102.          Height          =   375
  103.          Left            =   120
  104.          TabIndex        =   4
  105.          Top             =   1395
  106.          Width           =   1860
  107.       End
  108.       Begin VB.CommandButton Command2 
  109.          Caption         =   "Week Number"
  110.          Height          =   375
  111.          Left            =   120
  112.          TabIndex        =   3
  113.          Top             =   960
  114.          Width           =   1860
  115.       End
  116.       Begin VB.CommandButton Command3 
  117.          Caption         =   "Date2Julian"
  118.          Height          =   375
  119.          Left            =   2010
  120.          TabIndex        =   6
  121.          Top             =   960
  122.          Width           =   1860
  123.       End
  124.       Begin VB.CommandButton Command1 
  125.          Height          =   375
  126.          Left            =   3240
  127.          MaskColor       =   &H000000FF&
  128.          Picture         =   "frmDateDemo.frx":000C
  129.          Style           =   1  'Graphical
  130.          TabIndex        =   16
  131.          TabStop         =   0   'False
  132.          ToolTipText     =   "Calendar"
  133.          Top             =   255
  134.          UseMaskColor    =   -1  'True
  135.          Width           =   480
  136.       End
  137.       Begin VB.TextBox Text2 
  138.          Height          =   315
  139.          Left            =   1125
  140.          Locked          =   -1  'True
  141.          TabIndex        =   2
  142.          Text            =   "Text2"
  143.          ToolTipText     =   "+/- to change"
  144.          Top             =   255
  145.          Width           =   2010
  146.       End
  147.       Begin VB.Label Label2 
  148.          Caption         =   "Label2"
  149.          Height          =   255
  150.          Left            =   1155
  151.          TabIndex        =   17
  152.          Top             =   660
  153.          Width           =   2580
  154.       End
  155.    End
  156.    Begin VB.Frame Frame1 
  157.       Caption         =   "Limit Year - First Day of week is Sunday"
  158.       Height          =   945
  159.       Left            =   300
  160.       TabIndex        =   12
  161.       Top             =   195
  162.       Width           =   5880
  163.       Begin VB.CheckBox Check1 
  164.          Caption         =   "Show Week Numbers"
  165.          Height          =   465
  166.          Left            =   3915
  167.          TabIndex        =   19
  168.          TabStop         =   0   'False
  169.          Top             =   225
  170.          Value           =   1  'Checked
  171.          Width           =   1530
  172.       End
  173.       Begin VB.TextBox Text1 
  174.          Height          =   315
  175.          Left            =   1125
  176.          Locked          =   -1  'True
  177.          TabIndex        =   1
  178.          Text            =   "Text1"
  179.          ToolTipText     =   "+/- to change"
  180.          Top             =   255
  181.          Width           =   2010
  182.       End
  183.       Begin VB.CommandButton cmdDate 
  184.          Height          =   375
  185.          Left            =   3240
  186.          MaskColor       =   &H000000FF&
  187.          Picture         =   "frmDateDemo.frx":05CA
  188.          Style           =   1  'Graphical
  189.          TabIndex        =   13
  190.          TabStop         =   0   'False
  191.          ToolTipText     =   "Calendar"
  192.          Top             =   255
  193.          UseMaskColor    =   -1  'True
  194.          Width           =   480
  195.       End
  196.       Begin VB.Label Label1 
  197.          Caption         =   "Label1"
  198.          Height          =   255
  199.          Left            =   1155
  200.          TabIndex        =   14
  201.          Top             =   660
  202.          Width           =   2580
  203.       End
  204.    End
  205.    Begin VB.Label lblInfo 
  206.       Alignment       =   2  'Center
  207.       BackColor       =   &H00C0FFFF&
  208.       Caption         =   "Press +/-- to change date"
  209.       ForeColor       =   &H00000000&
  210.       Height          =   255
  211.       Left            =   315
  212.       TabIndex        =   22
  213.       Top             =   1155
  214.       Visible         =   0   'False
  215.       Width           =   5850
  216.    End
  217.    Begin VB.Label Label4 
  218.       Appearance      =   0  'Flat
  219.       BackColor       =   &H80000005&
  220.       BorderStyle     =   1  'Fixed Single
  221.       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."
  222.       ForeColor       =   &H80000008&
  223.       Height          =   735
  224.       Left            =   510
  225.       TabIndex        =   21
  226.       Top             =   4380
  227.       Width           =   5550
  228.    End
  229. Attribute VB_Name = "frmDateDemo"
  230. Attribute VB_GlobalNameSpace = False
  231. Attribute VB_Creatable = False
  232. Attribute VB_PredeclaredId = True
  233. Attribute VB_Exposed = False
  234. Option Explicit
  235. Dim cDatef As New clsDateUtilities
  236. Dim FirstDay As Date
  237. Private Sub Check1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  238.     lblInfo.Visible = False
  239. End Sub
  240. Private Sub Check2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  241.     lblInfo.Visible = False
  242. End Sub
  243. Private Sub cmdDate_Click()
  244.     If Check1.Value = vbChecked Then
  245.         Call SelectCalDate(Text1, , False, True, cDatef.RetFirstDayOfYear(vbSunday))
  246.     Else
  247.         Call SelectCalDate(Text1, , False, False, cDatef.RetFirstDayOfYear(vbSunday))
  248.     End If
  249. End Sub
  250. Private Sub cmdDate_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  251.     lblInfo.Visible = False
  252. End Sub
  253. Private Sub Command1_Click()
  254.     If Check2.Value = vbChecked Then
  255.         Call SelectCalDate(Text2, , True, True, FirstDay)
  256.     Else
  257.         Call SelectCalDate(Text2, , True, False)
  258.     End If
  259. End Sub
  260. Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  261.     lblInfo.Visible = False
  262. End Sub
  263. Private Sub Command10_Click()
  264.   Dim Y As Integer
  265.     If Month(CDate(Text2)) < 12 Then
  266.         Y = Year(CDate(Text2) + 6)
  267.     Else
  268.         Y = Year(CDate(Text2) - 6)
  269.     End If
  270.     Command10.Caption = cDatef.RetFirstDayOfYear(vbMonday, Y)
  271. End Sub
  272. Private Sub Command11_Click()
  273.     Command11.Caption = "Age: " & cDatef.RetAge(CDate(Text2), Date)
  274. End Sub
  275. Private Sub Command2_Click()
  276.     Command2.Caption = "Week: " & cDatef.RetWeekNumber(CDate(Text2), FirstDay)
  277. End Sub
  278. Private Sub Command3_Click()
  279.     Command3.Caption = "Julian: " & cDatef.Date2Julian(CDate(Text2), FirstDay)
  280. End Sub
  281. Private Sub Command4_Click()
  282.     Command4.Caption = "End: " & cDatef.EndOfMonth(CDate(Text2))
  283. End Sub
  284. Private Sub Command5_Click()
  285.     Command5.Caption = "Mondays: " & cDatef.WeekDaysInMonth(CDate(Text2), vbMonday)
  286. End Sub
  287. Private Sub Command6_Click()
  288.     Command6.Caption = "Wk Start: " & cDatef.RetBeginOfWeek(CDate(Text2), vbMonday)
  289. End Sub
  290. Private Sub Command7_Click()
  291.     Command7.Caption = "Wk End: " & cDatef.RetBeginOfWeek(CDate(Text2), vbMonday) + 6
  292. End Sub
  293. Private Sub Command8_Click()
  294.     cDatef.FillControlDates Combo1, FirstDay, True, True, Year(CDate(Text2))
  295. End Sub
  296. Private Sub Command9_Click()
  297.     Command9.Caption = CStr(cDatef.IsLeapYear(Year(CDate(Text2))))
  298. End Sub
  299. Private Sub Form_Load()
  300.     Text1 = Date
  301.     Text2 = Date - 720
  302. End Sub
  303. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  304.     lblInfo.Visible = False
  305. End Sub
  306. Private Sub Form_Unload(Cancel As Integer)
  307.     Set cDatef = Nothing
  308.     Set frmDateDemo = Nothing
  309. End Sub
  310. Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  311.     lblInfo.Visible = False
  312. End Sub
  313. Private Sub Frame2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  314.     lblInfo.Visible = False
  315. End Sub
  316. Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  317.     lblInfo.Visible = False
  318. End Sub
  319. Private Sub Label2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  320.     lblInfo.Visible = False
  321. End Sub
  322. Private Sub Text1_Change()
  323.     Label1 = Format(Text1, "dddd")
  324. End Sub
  325. Private Sub Text1_KeyPress(KeyAscii As Integer)
  326.     cDatef.PlusKey Text1, KeyAscii, True, False, cDatef.RetFirstDayOfYear
  327. End Sub
  328. Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  329.     lblInfo.Visible = True
  330. End Sub
  331. Private Sub Text2_Change()
  332.   Dim Y As Integer
  333.     If Month(CDate(Text2)) < 12 Then
  334.         Y = Year(CDate(Text2) + 6)
  335.     Else
  336.         Y = Year(CDate(Text2) - 6)
  337.     End If
  338.     Label2 = Format(Text2, "dddd")
  339.     FirstDay = cDatef.RetFirstDayOfYear(vbMonday, Y)
  340. End Sub
  341. Private Sub Text2_KeyPress(KeyAscii As Integer)
  342.     cDatef.PlusKey Text2, KeyAscii, False, False
  343. End Sub
  344. Private Sub Text2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  345.     lblInfo.Visible = True
  346. End Sub
  347.