VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Accept Only Numbers in Textbox

by Mark Anthony Dinglasa (13 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

Do you want to input only numbers in a textbox? and just want a few lines of code ?Well this code is for you....See it for yourself....Want to know more of my codes then email me....

Rate Accept Only Numbers in Textbox

'In the KeyPress event of a textbox
'Shall we say you have put one textbox in your form
'Here it goes
Private Sub text1_KeyPress(Keyascii as Integer)
Select case Keyascii
    
case asc(vbcr)  
      Keyascii=0 
    
    case 8,46
    case 47 to 58   
    case else
      Keyascii=0
End Select
End Sub

Download this snippet    Add to My Saved Code

Accept Only Numbers in Textbox Comments

No comments have been posted about Accept Only Numbers in Textbox. Why not be the first to post a comment about Accept Only Numbers in Textbox.

Post your comment

Subject:
Message:
0/1000 characters