top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Allow backspace in keypress event

+2 votes
103 views

I want only 4 digit numbers and delete and backspace.

posted Aug 26, 2014 by Merry

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes
 
Best answer
Private Sub TxtPStof_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtPStof.KeyPress 

    if e.KeyChar <> ControlChars.Back then
        e.Handled = Not (Char.IsDigit(e.KeyChar)  
    end if

End Sub 
answer Aug 27, 2014 by Asmita Agrawal
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...