I’ve searched the web and was unable to find what I am looking for. I’m using VS2010 and trying to make a w7p app. I’m trying to make a textbox that only accepts a single integer value from 0 to 5, so no negative and no decimal as any value higher crashes the app. Thank you!
Share
Use a
NumericUpDowncontrol, if there is one and you can just set theMinimumandMaximumproperties.If there’s not, use this in the
KeyDownevent of the textbox:This will suppress anything that is not a
0-5orBACKSPACEkey. Also, set yourMaximum Lengthproperty to1, it will allow only 0 through 5.