下面这个函数是实现限制录入字符的:不知道你们看到没有,我要允许中文的时候如何写这一句 :Case Function Limit_Only(ByVal x As Integer) As Integer
Select Case x
Case 8, 9, Asc("0") To Asc("9") '允许Tab,BackSpace和数字键
    Limit_Only = x
Case Asc("A") To Asc("Z") '允许大写字符
    Limit_Only = x
Case Asc("a") To Asc("z") '允许小写字符
    Limit_Only = x
Case '允许中文  此处如何写才允许有中文
    Limit_Only = x
Case Else
    Limit_Only = 0
End Select
End Function

解决方案 »

  1.   

    Dim Value As Long
        Value = (CLng(65536) + x) Mod 65536
        If x < 256 Then
            select case
            ...
            End Select
        Else
            If (CByte(Value \ 256) And &HA0) And (CByte(Value Mod 256) And &HA0) Then
                时中文
            Else
                x = 0
            End If
        End If
      

  2.   


    if ASC(X)<0 then msgbox X & "是中文"
      

  3.   

    你可以这个样子,用lenB()来取得单个字的字节数两个字节则为汉字,否则不是。
      

  4.   

    Function Limit_Only(ByVal x As Integer) As Integer
    Select Case x
    Case 8, 9, Asc("0") To Asc("9") '允许Tab,BackSpace和数字键
        Limit_Only = x
    Case Asc("A") To Asc("Z") '允许大写字符
        Limit_Only = x
    Case Asc("a") To Asc("z") '允许小写字符
        Limit_Only = x
    Case Else
        Dim Value As Long
        Value = (CLng(65536) + x) Mod 65536
        If (CByte(Value \ 256) And &HA0) And (CByte(Value Mod 256) And &HA0) Then
                Limit_Only = x
        Else
              Limit_Only = 0
        End If
     End Select
    End Function