Private Sub Command1_Click()
Text2.Text = Left(Text1.Text, 1) & "/" & Mid(Text1.Text, 2, 1) & "/" & Right(Text1.Text, 1)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End If
End Sub
Private Sub Text1_Validate(Cancel As Boolean)
Dim xx, yy As String
If Text1 <> "" Then
xx = Trim(Text1.Text)
Text1 = Mid(xx, 1, 4) & "/" & Mid(xx, 5, 2) & "/" & Mid(xx, 7, 2)
If Not IsDate(Text1) Then
Cancel = True
MsgBox "请按 yyyymmdd 格式输入", , "系统信息提示"
Text1 = ""
End If
End If