Const NOChar As String = "[\w-.]"    '是否为有效的编号
    Public Shared Function IsNOChar(ByVal strS As String) As Boolean
        Dim r As Regex = New Regex(NOChar, RegexOptions.ECMAScript)
        If (r.IsMatch(strS)) Then
            Return True
        End If
    End Function    '是否为有效的编号字符
    Public Shared Function IsNOChar(ByVal strS As Char) As Boolean
        Dim r As Regex = New Regex(NOChar, RegexOptions.ECMAScript)        If (r.IsMatch(strS)) Then
            Return True
        End If
    End Function调用:
    Private Sub txtID_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtID.KeyPress
        If Not Config.TextValidate.IsNOChar(e.KeyChar) Then
            If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 127 Then
                e.Handled = True
            End If
        End If
    End Sub问题出来了,我写的正则表达式可以输入中文!!!!