KeyPress event and KeyAscii 
Author Message
 KeyPress event and KeyAscii

Hi Pete:

Quote:
>However, I now need to use A - Z (Asc 65 - 90), a - z (Asc 97 - 122) and
>also a sign (Asc 163) and a $ sign (Asc 36).

>Is the any way I can code to ignore BETWEEN certain characters, i.e.

Select Case KeyAscii
Case 36, 65 To 90, 97 To 122, 163
    KeyAscii = 0
End Select

Doug.



Sun, 22 Apr 2001 03:00:00 GMT  
 KeyPress event and KeyAscii
I often use the keyPress event to allow only certain characters to be
entered into a text box using: -

    If KeyAscii < Asc("-") Or KeyAscii > Asc("9") Or KeyAscii = Asc("/")
Then
        KeyAscii = 0
    End If

(On this occasion to allow 1 - 9 and a minus operator and a decimal point
only)

However, I now need to use A - Z (Asc 65 - 90), a - z (Asc 97 - 122) and
also a sign (Asc 163) and a $ sign (Asc 36).

Is the any way I can code to ignore BETWEEN certain characters, i.e.


        KeyAscii = 0
    End If

I do realise that there is no ISBETWEEN keyword but just use this to show
what I am trying to achieve.

Pete Boys



Mon, 23 Apr 2001 03:00:00 GMT  
 KeyPress event and KeyAscii
Check out the masked edit control.
Quote:

> I often use the keyPress event to allow only certain characters to be
> entered into a text box using: -

>     If KeyAscii < Asc("-") Or KeyAscii > Asc("9") Or KeyAscii = Asc("/")
> Then
>         KeyAscii = 0
>     End If

> (On this occasion to allow 1 - 9 and a minus operator and a decimal point
> only)

> However, I now need to use A - Z (Asc 65 - 90), a - z (Asc 97 - 122) and
> also a sign (Asc 163) and a $ sign (Asc 36).

> Is the any way I can code to ignore BETWEEN certain characters, i.e.


>         KeyAscii = 0
>     End If

> I do realise that there is no ISBETWEEN keyword but just use this to show
> what I am trying to achieve.

> Pete Boys



Wed, 02 May 2001 03:00:00 GMT  
 KeyPress event and KeyAscii
Check out LIKE keyword under IF - THEN statement help.
Quote:

>Check out the masked edit control.


>> I often use the keyPress event to allow only certain characters to be
>> entered into a text box using: -

>>     If KeyAscii < Asc("-") Or KeyAscii > Asc("9") Or KeyAscii = Asc("/")
>> Then
>>         KeyAscii = 0
>>     End If

>> (On this occasion to allow 1 - 9 and a minus operator and a decimal point
>> only)

>> However, I now need to use A - Z (Asc 65 - 90), a - z (Asc 97 - 122) and
>> also a sign (Asc 163) and a $ sign (Asc 36).

>> Is the any way I can code to ignore BETWEEN certain characters, i.e.


>>         KeyAscii = 0
>>     End If

>> I do realise that there is no ISBETWEEN keyword but just use this to show
>> what I am trying to achieve.

>> Pete Boys



Wed, 02 May 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. KeyPress event -- setting KeyAscii fails

2. KeyDown, KeyPress, KeyCode, KeyAscii?????????????????????

3. How to avoid KeyPress event after a specific KeyDown event

4. Keypress event, line disappearance and wait event

5. Old qestion, but forgot answer (key press events keyascii)

6. The effect of KeyAscii=0 in a sub called by KeyPress event?

7. The efffect of KeyAscii=0 in a sub called by KeyPress event?

8. !URGENT! DBGrid ignores changes to KeyAscii in KeyPress Event WHY?

9. No DELETE key acknowledgement wih KeyPress event

10. MSFlexGrid keypress event

11. VBA Forms and KeyPress Event?

12. KeyPress Event ?

 

 
Powered by phpBB® Forum Software