首先,你的20分是不是与你的问题的分量不相称:)所以没人回答。 1)Private Sub Text1_KeyPress(KeyAscii As Integer) Static Ser As Integer Select Case Ser Case 0 If (KeyAscii < 48) Or ((KeyAscii > 57) And (KeyAscii < 65)) Or ((KeyAscii > 90) And (KeyAscii < 97)) Or (KeyAscii > 122) Then KeyAscii = 0 Else If KeyAscii > 96 Then KeyAscii = KeyAscii - 32
End If Ser = Ser + 1 End If Case 1, 2 If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0 Else Ser = Ser + 1 End If Case Else '以下三行回答你第三个问题,输完3个后自动跳到另一控件 Ser = 0 KeyAscii = 0 Text2.SetFocus End Select End Sub2)Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0 Else If Len(Text2.Text) = 8 Then KeyAscii = 0 Text2.Text = Left(Text2.Text, 4) + "/" + Mid(Text2.Text, 5, 2) + "/" + Right(Text2.Text, 2) Text1.SetFocus End If End If
End Sub 3)已经回答了,见1) 4)没时间了,我要出去了,下次再写:)
Please capture Edit control`s message,you can do every thing you want!
1)Private Sub Text1_KeyPress(KeyAscii As Integer)
Static Ser As Integer
Select Case Ser
Case 0
If (KeyAscii < 48) Or ((KeyAscii > 57) And (KeyAscii < 65)) Or ((KeyAscii > 90) And (KeyAscii < 97)) Or (KeyAscii > 122) Then
KeyAscii = 0
Else
If KeyAscii > 96 Then
KeyAscii = KeyAscii - 32
End If
Ser = Ser + 1
End If
Case 1, 2
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
Else
Ser = Ser + 1
End If
Case Else '以下三行回答你第三个问题,输完3个后自动跳到另一控件
Ser = 0
KeyAscii = 0
Text2.SetFocus
End Select
End Sub2)Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
Else
If Len(Text2.Text) = 8 Then
KeyAscii = 0
Text2.Text = Left(Text2.Text, 4) + "/" + Mid(Text2.Text, 5, 2) + "/" + Right(Text2.Text, 2)
Text1.SetFocus
End If
End If
End Sub
3)已经回答了,见1)
4)没时间了,我要出去了,下次再写:)