www.pudn.com > jxc001.rar > FrmSysDate.frm


VERSION 5.00 
Begin VB.Form FrmSysDate  
   BorderStyle     =   3  'Fixed Dialog 
   Caption         =   "系统日期" 
   ClientHeight    =   1155 
   ClientLeft      =   2760 
   ClientTop       =   3750 
   ClientWidth     =   5685 
   Icon            =   "FrmSysDate.frx":0000 
   LinkTopic       =   "Form1" 
   MaxButton       =   0   'False 
   MinButton       =   0   'False 
   ScaleHeight     =   1155 
   ScaleWidth      =   5685 
   ShowInTaskbar   =   0   'False 
   Begin VB.TextBox Text1  
      Height          =   315 
      Index           =   2 
      Left            =   3060 
      MaxLength       =   2 
      TabIndex        =   2 
      Top             =   360 
      Width           =   315 
   End 
   Begin VB.TextBox Text1  
      Height          =   315 
      Index           =   1 
      Left            =   2460 
      MaxLength       =   2 
      TabIndex        =   1 
      Top             =   360 
      Width           =   315 
   End 
   Begin VB.TextBox Text1  
      Height          =   315 
      Index           =   0 
      Left            =   1680 
      MaxLength       =   4 
      TabIndex        =   0 
      Top             =   360 
      Width           =   495 
   End 
   Begin VB.CommandButton OKButton  
      Caption         =   "确定" 
      Height          =   375 
      Left            =   4080 
      TabIndex        =   3 
      Top             =   360 
      Width           =   1215 
   End 
   Begin VB.Label Label1  
      Caption         =   "年" 
      Height          =   195 
      Index           =   3 
      Left            =   2220 
      TabIndex        =   7 
      Top             =   420 
      Width           =   195 
   End 
   Begin VB.Label Label1  
      Caption         =   "月" 
      Height          =   195 
      Index           =   2 
      Left            =   2820 
      TabIndex        =   6 
      Top             =   420 
      Width           =   195 
   End 
   Begin VB.Label Label1  
      Caption         =   "日" 
      Height          =   195 
      Index           =   1 
      Left            =   3420 
      TabIndex        =   5 
      Top             =   420 
      Width           =   195 
   End 
   Begin VB.Label Label1  
      Alignment       =   1  'Right Justify 
      Caption         =   "请输入系统日期:" 
      Height          =   195 
      Index           =   0 
      Left            =   180 
      TabIndex        =   4 
      Top             =   420 
      Width           =   1455 
   End 
End 
Attribute VB_Name = "FrmSysDate" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
 
Option Explicit 
 
Private Sub Form_Load() 
    Text1(0).Text = Year(Date) 
    Text1(1).Text = Month(Date) 
    Text1(2).Text = Day(Date) 
    Text1(0).SelStart = 0 
    Text1(0).SelLength = Len(Text1(0).Text) 
End Sub 
 
Private Sub OKButton_Click() 
    Dim strCurDate As String 
    strCurDate = Trim(Me.Text1(0).Text) & "-" & Trim(Me.Text1(1).Text) 
    strCurDate = strCurDate & "-" & Trim(Me.Text1(2).Text) 
    If Not IsDate(strCurDate) Then 
        MsgBox "日期输入错误!", vbCritical, "系统日期" 
        Me.Text1(0).SelStart = 0 
        Me.Text1(0).SelLength = Len(Me.Text1(0).Text) 
        Me.Text1(0).SetFocus 
    Else 
        dteSysDate = CDate(strCurDate) 
        Unload Me 
    End If 
End Sub 
 
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer) 
    Dim strValid As String 
    strValid = "0123456789" 
    If KeyAscii = 13 Then 
        If Index < 2 Then 
            Text1(Index + 1).SelStart = 0 
            Text1(Index + 1).SelLength = Len(Text1(Index + 1).Text) 
            Text1(Index + 1).SetFocus 
        Else 
            Me.OKButton.SetFocus 
        End If 
    End If 
    If KeyAscii > 26 Then 
        If InStr(strValid, Chr(KeyAscii)) = 0 Then 
            KeyAscii = 0 
        End If 
    End If 
'    Select Case Index 
'        Case 1 
'            If Text1(Index).Text < 1 Or Text1(Index).Text > 12 Then 
'            End If 
'    End Select 
End Sub