Search Tools Links Login

Check for extended ASCII


Checks to make sure the contents of a TextBox or String are only standard ASCII; If it has any extended ASCII, the function will return False.

Original Author: Alex Bylund

Assumptions

Use like this:
If Valid_ASCII(Text1) = False Then
MsgBox "Invalid chars!"
Exit sub
End If

Code

Function Valid_ASCII(Text As String)
For x = 1 To Len(Text)
  If Asc(Mid(Text, x, 1)) > 126 Or Asc(Mid(Text, x, 1)) < 32 Then
   Valid_ASCII = False
   Exit Function
  End If
Next x
Valid_ASCII = True
End Function

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 73 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.