|
-
Nov 4th, 2001, 01:16 PM
#1
Thread Starter
Hyperactive Member
numbers / text only
is there a function that checks if a string is only letters and numbers?
kindof like isnumeric() but includes letters too.
and if there isn't a function that does letters and numbers, is there one that just checks for letters?
thanks very much!
-
Nov 4th, 2001, 01:19 PM
#2
PowerPoster
Well
ISNUMERIC(?) will check for numbers..
You could use MASKEDEDITBOX to control what the users enters...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Nov 4th, 2001, 01:22 PM
#3
Lively Member
check dis out fa letters
VB Code:
Public Function IsAlpha(str As String) As Boolean
'only likes A-Z or a-z
Dim i As Long
For i = 1 To Len(str)
If Asc(Mid$(str, i, 1)) >= 65 And Asc(Mid$(str, i, 1)) <= 90 Or Asc(Mid$(str, i, 1)) >= 97 And Asc(Mid$(str, i, 1)) <= 122 Then
'it's good!
Else
IsAlpha = False
Exit Function
End If
Next i
IsAlpha = True
End Function
Private Sub Command1_Click()
MsgBox IsAlpha("hello") 'returns true
MsgBox IsAlpha("hello1") 'returns false
End Sub
respect
-
Nov 4th, 2001, 01:57 PM
#4
Thread Starter
Hyperactive Member
how do i use MASKEDEDITBOX?
-
Nov 4th, 2001, 01:58 PM
#5
Lively Member
maskededitbox is mingin'
use da code to check for da letters
fa da numbers, use da IsNumeric function
Respect
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|