Results 1 to 7 of 7

Thread: KeyAscii question

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344
    This stops me from typing text, but how would i be able to write text and stop numbers?
    If KeyAscii < 48 Or KeyAscii > 57 Then
    KeyAscii = 0
    Beep
    End If
    -RaY
    VB .Net 2010 (Ultimate)

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Since your using VB3 you don't have the constants but this code works.
    Code:
    If KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Then
        KeyAscii = 0
    End If

  3. #3
    Member Red Thread's Avatar
    Join Date
    Aug 2000
    Location
    Europe-Belgium
    Posts
    44

    Talking IsNumeric

    maybe you can use the isnumeric-function...

    Check your msdn help about this !

    ex.
    ---------------------------------------
    If IsNumeric(text1.text) True Then
    'It's numeric !
    Else
    ' It's Not !
    End If
    ---------------------------------------

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: IsNumeric

    Originally posted by Red Thread
    maybe you can use the isnumeric-function...
    IsNumeric didn't exist in VB3

  5. #5
    Member Red Thread's Avatar
    Join Date
    Aug 2000
    Location
    Europe-Belgium
    Posts
    44

    Unhappy Oeps...

    Oeppssss

    Don't know if VB3 has this function...

    I'll doubt it

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Isnumeric allows some special characters -+ and DE, so i suggest you compare with like operator:
    Code:
    If not (text1 like "*#*") then 'contains numbers
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344

    Thanks guys

    Thanks got it to work, and kedman thanks for that post that was my next question!
    -RaY
    VB .Net 2010 (Ultimate)

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