vb.net - How do you allow only numbers, backspace, and hyphens in a text box in Visual Studio 2010? -


if (e.keychar < "0" orelse e.keychar > "9") andalso e.keychar <> controlchars.back andalso e.keychar = "-"     e.handled = true 

i can't seem code working. trying include text box enter numbers, backspace, , hyphens working, hyphens not working, other work. help?

use maskedtextbox. it's pretty useful control. without coding allows specify characters allowed in textbox, think looking for.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -