PrivateSubText7_Change(IndexAsInteger)SelectCaseIndexCase0IfLen(Text7(0).Text)=4OrLen(Text7(0).Text)=7ThenText7(0).Text=Text7(0).Text+"/"Text7(0).SelStart=Len(Trim(Text7(...
Private Sub Text7_Change(Index As Integer)
Select Case Index
Case 0
If Len(Text7(0).Text) = 4 Or Len(Text7(0).Text) = 7 Then Text7(0).Text = Text7(0).Text + "/"
Text7(0).SelStart = Len(Trim(Text7(0).Text)) '把光标移动到文本框最后一个字符后
End Select
End Sub
Private Sub Text7_KeyPress(Index As Integer, KeyAscii As Integer)
Select Case Index
Case 1 To 4
If Len(Text7(Index).Text) = 4 And KeyAscii <> 8 Then KeyAscii = 0
If KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8 Then
KeyAscii = KeyAscii
Else
KeyAscii = 0
End If
Case 0
If KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8 Then
KeyAscii = KeyAscii
Else
KeyAscii = 0
End If
End Select
End Sub
这是我的代码,请帮我解决一下!
展开