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

Capture and play voice with Asterisk ARI -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -