I'm trying to handle my textbox input values. I want the user to only be able to input numbers within a range using KeyPress. Ex. (0 - 1000). I have the code to prevent any input thats not a number. I can't quite figure out how to prevent the user from inputting a value thats not within a certain range.
Private Sub txt2x6LumberQuanity_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txt2x6LumberQuanity.KeyPress
If Not Char.IsNumber(e.KeyChar) And Not Char.IsControl(e.KeyChar) Then
e.Handled = True
End If
End Sub
Does anybody have any suggestions. I've spent a couple hours searching but can't seem to find the right solution.
I would use the text changed and
ErrorProvider
component for this effect:Valid Entry
Invalid Entry
You could add this to the Keypress event handler