John Delmark Aguilar

Delmark - Profiling
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Disable Letters via Textbox and sql Injection

View previous topic View next topic Go down 
AuthorMessage
dElmARk
Admin
Admin
avatar

Posts : 92
Join date : 09/04/2012

PostSubject: Disable Letters via Textbox and sql Injection   Sun Nov 25, 2012 3:08 pm

The following will allow only numeric text to be entered in the
textbox as well as allowing control characters such as backspace, delete
etc.
Code:

 Private Sub TextBox1_KeyPress(ByVal sender As
Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
TextBox1.KeyPress
        If Not (Char.IsDigit(e.KeyChar) Or Char.IsControl(e.KeyChar)) Then
            e.Handled = True
        End If
    End Sub

 

The following will allow all characters except single and double quotes.

Code:


 Private Sub TextBox1_KeyPress(ByVal sender As
Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
TextBox1.KeyPress
        If Not (Char.IsLetterOrDigit(e.KeyChar) Or Char.IsControl(e.KeyChar)) Then
            If Asc(e.KeyChar) = 39 Or Asc(e.KeyChar) = 34 Then
                e.Handled = True
            End If
        End If
    End Sub
Back to top Go down
View user profile http://delmark.meabout.com
 
Disable Letters via Textbox and sql Injection
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
John Delmark Aguilar :: dElmARk Productions :: VB.net Programs :: VB Tutorials | Tips and Tricks-
Jump to: