VB中,"回车"也是字符吗,代码内详

Dim n1 As Integer, n2 As Integer, n3 As Integer
Private Sub txtinput_Change()
Dim s As String
s = Right(txtinput.Text, 1)
If s <> "." Then
If UCase(s) >= "A" And UCase(s) <= "z" Then
n1 = n1 + 1
txtletter.Text = n1
ElseIf s >= "0" And s <= "9" Then
n2 = n2 + 1
txtdigital.Text = n2
Else
n3 = n3 + 1
txtother.Text = n3
End If
Else
txtinput.Enabled = False
End If

End Sub
调试了一下,为什么可以输入字母数字各种符号包括空格,就是无法输入回车,也就是回车按下去没有反应,教科书上说回车也是字符,是可以输入的

可以输入的,回车是一个换行符号,要设置文本框的 MultiLine 设为 true 才能接收回车符号
温馨提示:答案为网友推荐,仅供参考
第1个回答  2008-12-20
vbCrLf 你看下 或者chr(13)
第2个回答  2008-12-20
是可以输入的,但要看你的控件是什么控件,你用备注控件一定无问题
第3个回答  2008-12-20
回车是控制字符.是不可见的!如果文本框设置了Multiline为 true才可以看见效果.