www.pudn.com > gdqj1a302.zip > SelDtime.frm


VERSION 5.00 
Begin VB.Form fmSelDtime  
   BackColor       =   &H00C0C000& 
   BorderStyle     =   0  'None 
   Caption         =   "GetDtime" 
   ClientHeight    =   2595 
   ClientLeft      =   1965 
   ClientTop       =   3840 
   ClientWidth     =   8625 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   2595 
   ScaleWidth      =   8625 
   ShowInTaskbar   =   0   'False 
   Begin VB.CommandButton Command2  
      Caption         =   "取消" 
      Height          =   435 
      Left            =   7110 
      TabIndex        =   9 
      Top             =   1530 
      Width           =   945 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "确认" 
      Height          =   435 
      Left            =   7050 
      TabIndex        =   8 
      Top             =   750 
      Width           =   975 
   End 
   Begin VB.TextBox Text1  
      BeginProperty Font  
         Name            =   "MS Sans Serif" 
         Size            =   9.75 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   375 
      Index           =   5 
      Left            =   4920 
      TabIndex        =   7 
      Text            =   "00" 
      Top             =   660 
      Width           =   435 
   End 
   Begin VB.TextBox Text1  
      BeginProperty Font  
         Name            =   "MS Sans Serif" 
         Size            =   9.75 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   375 
      Index           =   4 
      Left            =   4080 
      TabIndex        =   6 
      Text            =   "00" 
      Top             =   690 
      Width           =   405 
   End 
   Begin VB.TextBox Text1  
      BeginProperty Font  
         Name            =   "MS Sans Serif" 
         Size            =   9.75 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   375 
      Index           =   3 
      Left            =   3210 
      TabIndex        =   5 
      Text            =   "00" 
      Top             =   660 
      Width           =   375 
   End 
   Begin VB.TextBox Text1  
      BeginProperty Font  
         Name            =   "MS Sans Serif" 
         Size            =   9.75 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   375 
      Index           =   2 
      Left            =   2130 
      TabIndex        =   4 
      Text            =   "1" 
      Top             =   660 
      Width           =   405 
   End 
   Begin VB.TextBox Text1  
      BeginProperty Font  
         Name            =   "MS Sans Serif" 
         Size            =   9.75 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   375 
      Index           =   1 
      Left            =   1350 
      TabIndex        =   3 
      Text            =   "1" 
      Top             =   660 
      Width           =   435 
   End 
   Begin VB.TextBox Text1  
      BeginProperty Font  
         Name            =   "MS Sans Serif" 
         Size            =   9.75 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   375 
      Index           =   0 
      Left            =   360 
      TabIndex        =   2 
      Text            =   "2000" 
      Top             =   660 
      Width           =   615 
   End 
   Begin VB.ListBox List1  
      BackColor       =   &H00FFFFC0& 
      Columns         =   6 
      Height          =   1035 
      Left            =   720 
      TabIndex        =   1 
      Top             =   1290 
      Width           =   5895 
   End 
   Begin VB.Label Label2  
      BackStyle       =   0  'Transparent 
      Caption         =   "秒" 
      Height          =   315 
      Index           =   5 
      Left            =   5400 
      TabIndex        =   15 
      Top             =   750 
      Width           =   255 
   End 
   Begin VB.Label Label2  
      BackStyle       =   0  'Transparent 
      Caption         =   "分" 
      Height          =   315 
      Index           =   4 
      Left            =   4530 
      TabIndex        =   14 
      Top             =   750 
      Width           =   165 
   End 
   Begin VB.Label Label2  
      BackStyle       =   0  'Transparent 
      Caption         =   "时" 
      Height          =   315 
      Index           =   3 
      Left            =   3630 
      TabIndex        =   13 
      Top             =   750 
      Width           =   255 
   End 
   Begin VB.Label Label2  
      BackStyle       =   0  'Transparent 
      Caption         =   "日" 
      Height          =   255 
      Index           =   2 
      Left            =   2580 
      TabIndex        =   12 
      Top             =   750 
      Width           =   255 
   End 
   Begin VB.Label Label2  
      BackStyle       =   0  'Transparent 
      Caption         =   "月" 
      Height          =   315 
      Index           =   1 
      Left            =   1770 
      TabIndex        =   11 
      Top             =   720 
      Width           =   255 
   End 
   Begin VB.Label Label2  
      BackStyle       =   0  'Transparent 
      Caption         =   "年" 
      Height          =   315 
      Index           =   0 
      Left            =   990 
      TabIndex        =   10 
      Top             =   750 
      Width           =   255 
   End 
   Begin VB.Label Label1  
      BackStyle       =   0  'Transparent 
      Caption         =   "请输入时间信息:" 
      BeginProperty Font  
         Name            =   "MS Sans Serif" 
         Size            =   9.75 
         Charset         =   0 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   255 
      Left            =   330 
      TabIndex        =   0 
      Top             =   240 
      Width           =   4335 
   End 
End 
Attribute VB_Name = "fmSelDtime" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
'*************************************************************************** 
' SetTime.frm  设置日期时间 
'*************************************************************************** 
 
Option Explicit 
Public sDatetime As String          '设置的日期时间字串 
Dim iText As Integer 
 
'确定日期 
Private Sub Command1_Click() 
        sDatetime = Text1(0).Text & "-" & Text1(1).Text & "-" & Text1(2).Text _ 
            & " " & Text1(3).Text & ":" & Text1(4).Text & ":" & Text1(5).Text 
        If IsDate(sDatetime) Then 
            Unload Me 
        Else 
            MsgBox "Please input valid date and time " 
        End If 
End Sub 
 
Private Sub Command2_Click() 
    sDatetime = "" 
    Unload Me 
End Sub 
 
Private Sub Form_Load() 
    iText = 0 
    SetList 
    Text1(0).Text = Format(Date, "yyyy") 
    Text1(1).Text = Format(Date, "mm") 
    Text1(2).Text = Format(Date, "dd") 
    Text1(3).Text = Format(Time, "hh") 
    Text1(4).Text = Format(Time, "nn") 
    Text1(5).Text = Format(Time, "ss") 
End Sub 
 
Private Sub SetList() 
    Dim i%, i1%, i2%, nc%, sfmt$ 
    Select Case iText 
        Case 0: nc% = 10: i1% = 2000: i2 = 2044: sfmt = "0000" 
        Case 1: nc% = 10: i1% = 1: i2% = 12: sfmt = "00" 
        Case 2: nc% = 10: i1% = 1: 
                Select Case Val(Text1(1).Text) 
                    Case 1, 3, 5, 7, 8, 10, 12: i2% = 31 
                    Case 4, 6, 9, 11: i2% = 30 
                    Case 2: 
                            If Val(Text1(0).Text) Mod 4 = 0 Then 
                                i2 = 29 
                            Else 
                                i2 = 28 
                            End If 
                 End Select 
        Case 3: nc% = 10: i1% = 0: i2% = 23: sfmt = "00" 
        Case 4: nc% = 15: i1% = 0: i2% = 59: sfmt = "00" 
        Case 5: nc% = 15: i1% = 0: i2% = 59: sfmt = "00" 
    End Select 
    List1.Clear 
    List1.Columns = nc% 
    For i% = i1% To i2% 
        List1.AddItem Format(i%, "00") 
    Next i% 
End Sub 
 
Private Sub List1_Click() 
    Text1(iText).Text = List1.Text 
    iText = iText + 1 
    If iText >= 6 Then 
        iText = 0 
    End If 
    Text1(iText).SetFocus 
End Sub 
 
Private Sub Text1_GotFocus(Index As Integer) 
    iText = Index 
    SetList 
End Sub