如果是abcd是变量,应该是这么写:
text5.text
= a
+
b
+
c
+
d
如果是想把4个字符进行连接,应该是这么写:
text5.text
=
"a“
&
"b"
&
"c"
&
"d"
或者
text5.text
=
"a“
+
"b"
+
"c"
+
"d"
Private Sub Text1_Change()
Dim s As String, o As String, p As Long
p = Text1.SelStart
'保存光标位置
s = Text1.Text
While Len(s) >= 1
If IsNumeric(Left(s, 1)) = False Then o = o & Left(s, 1)
'如果不是数字则保留
s = Right(s, Len(s) - 1)
Wend
Text1.Text = o
Text1.SelStart = p
End Sub
Private Sub Text1_Change()
For i = 1 To Len(Text1.Text)
If Abs(Asc(Mid(Text1.Text, i, 1))) > 255 Then
Text1.Text = Replace(Text1.Text, Mid(Text1.Text, i, 1), "")
End If
Next
End Sub
不过这样做的缺点是光标在输入中文后会自动跳到起点