Results 1 to 5 of 5

Thread: numbers / text only

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Pittsburgh, PA
    Posts
    329

    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!
    ______________

  2. #2
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    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....

  3. #3
    Lively Member Ali G's Avatar
    Join Date
    Nov 2001
    Location
    Staines
    Posts
    120
    check dis out fa letters
    VB Code:
    1. Public Function IsAlpha(str As String) As Boolean
    2. 'only likes A-Z or a-z
    3.  
    4. Dim i As Long
    5.  
    6. For i = 1 To Len(str)
    7.     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
    8.         'it's good!
    9.     Else
    10.         IsAlpha = False
    11.         Exit Function
    12.     End If
    13. Next i
    14.  
    15. IsAlpha = True
    16.  
    17. End Function
    18.  
    19. Private Sub Command1_Click()
    20.  
    21. MsgBox IsAlpha("hello") 'returns true
    22. MsgBox IsAlpha("hello1") 'returns false
    23.  
    24. End Sub
    respect

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Pittsburgh, PA
    Posts
    329
    how do i use MASKEDEDITBOX?
    ______________

  5. #5
    Lively Member Ali G's Avatar
    Join Date
    Nov 2001
    Location
    Staines
    Posts
    120
    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
  •  



Click Here to Expand Forum to Full Width