Click here to Skip to main content
15,032,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am trying to restrict my user from inserting characters or special chars,spaces etc only numbers are allowed, i also want to restrict sql injection. Please help me with a code.
Posted

If you want to restrict user from inerting xters then use this code:

If Not IsNumeric(Trim(Nameoftextbox.text))Then

'Display messagebox here

Return

End If

Now, Use parameter to avoid sql injection
   
If you want any specific format, then either use Masked textbox or use Regular Expression as validation expression on KeyUp event of textbox.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900