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
Post a Comment