我在TextBox控件中要输入XXXX-XX-XX的格式的,现在要有其中的一条横线,怎么搞阿
我在TextBox控件中要输入XXXX-XX-XX的格式的,现在要有其中的一条横线,怎么搞阿
[解决办法]
用maskEdbox
[解决办法]
Option Explicit
Dim sj As String
Dim Date_sj As String
Private Sub Form_Load()
sj = "****-**-** "
Text1 = sj
Text1.SelStart = 0
Text1.SelLength = 4
End Sub
Private Sub Text1_Change()
Static i As Integer
i = i + 1
If i = 5 Then
Text1.SelStart = i
Text1.SelLength = 2
ElseIf i = 7 Then
Text1.SelStart = i + 1
Text1.SelLength = 2
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Len(Text1) = 10 Then
Date_sj = Text1
Command1.SetFocus
End If
End Sub