查看: 103  |  回复: 0
VB6 显示可见字符
楼主
发表于 2月23日 17:28

新建From1(窗体),新建Command1(按钮CommandButton),代码:

Private Sub Command1_Click()
    Dim intByte As Integer
    Dim strAll As String
    Dim strChar As String
    
    intByte = Asc(Left(Text1, 1))
    
    If intByte >= 32 And intByte <= 126 Then
        strChar = strChar & Chr(intByte)
    Else
        strChar = strChar & "?"
    End If
    Debug.Print strChar
End Sub

在Text1中输入一个字符可以在debug中看到,如果输入中文等就显示?号。

您需要登录后才可以回帖 登录 | 立即注册
【本版规则】请勿发表违反国家法律的内容,否则会被冻结账号和删贴。
用户名: 立即注册
密码:
2020-2024 MaNongKu.com