vb.net - keypress to block letter/number on visual basic 2012 OOP method -
i want create register form using visual studio 2012 , sql server 2012.
the function want is: in windows form there 2 textbox:
if type number on first textbox program block number , allow letter
in second textbox program block letter , allow number
i heard use keypress.
what coding keypress that?
you need use ascii values :
if asc(e.keychar) <> 8 if asc(e.keychar) < 48 or asc(e.keychar) > 57 e.handled = true end if end if
in above example, use can enter numbers , can use backspace
because function allow these ascii characters on keypress event.
8 -> backspace, 48-57 -> 0 9
similarly use ascii characters characters z ( both capital , small )
Comments
Post a Comment