Allowing ONLY text to be typed in my text box - NO NUMBERS 
Author Message
 Allowing ONLY text to be typed in my text box - NO NUMBERS

Hi,

I just wanted to know how I would go about telling my text box to accept
text and no numbers.
Everytime I type some text in (Life say your name) and I press TAB to shift
the focus to another
text box, for some unknown reason I get a Error 13 - Type Mismatch.

Why won't my error handler recognise and allow the text to be left in there
and give me the error
message when I leave numbers in there.... it's like my error handler does
the opposite at the moment.
Please leave some sample code so I know what you are talking about..

Thank You  !!!!

- Greg



Tue, 25 Feb 2003 22:26:12 GMT  
 Allowing ONLY text to be typed in my text box - NO NUMBERS
Greg,

How about disallowing numbers like this?

Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii >= vbKey0 And KeyAscii <= vbKey9 Then
        KeyAscii = 0
        Beep
    End If
End Sub

Would that work?

Michael


Quote:
> Hi,

> I just wanted to know how I would go about telling my text box to accept
> text and no numbers.
> Everytime I type some text in (Life say your name) and I press TAB to
shift
> the focus to another
> text box, for some unknown reason I get a Error 13 - Type Mismatch.

> Why won't my error handler recognise and allow the text to be left in
there
> and give me the error
> message when I leave numbers in there.... it's like my error handler does
> the opposite at the moment.
> Please leave some sample code so I know what you are talking about..

> Thank You  !!!!

> - Greg



Wed, 26 Feb 2003 12:16:25 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Allowing ONLY text to be typed in my text box - NO NUMBERS

2. Filter A Report From a Pop-Up Box for Text, Numbers, and Yes/No Field Types

3. Am I allowed to copy texts and DLLs?

4. Text box text on new page text box

5. code to type in text in a text box

6. Exporting a 3 decimal number to text file produces trunc 2 decimal text number

7. Text-Control (only numbers allowed)

8. Converting text in text boxes to inline text

9. Rich Text Box: Can I remove text and keep multicolored text

10. VBX which is text box which allows line feeds

11. Allowing only certain characters in a text box in vbscript

12. how to get scrolling text in a text box or like Marquee text

 

 
Powered by phpBB® Forum Software