I need help with a little problem. I haven't been programming long and can't figure out how to fix this. I have a small project for school and I can't figure out why I'm getting this error when validating inputs.
For example, I'm checking if the input is valid and between a min and max range by creating a function to return a true or false value based on the values entered. The reason I'm using a function is because I'm doing multiple similar checks and I figured rather than rewriting it out again, this was the best way to do this task.
Do While inputValid(string, min, max)
This is my validation, below is the simple function to validate this.
Private Function inputValid(input As String, min As Integer, max As Integer)
If Not IsNumeric(input) Then
Return False
End If
If input > min Or input < max Then
Return False
Else
Return True
End If
End Function
For some reason, despite the fact it should make sure that the value is numeric before it checks whether it's within a numerical range. It still sends me an error when I type nothing or a string in because it's trying to convert it to a double yet if I'm not doing any between range checks, it checks just fine if it's only numeric with no errors.
Can anyone help me fix this? Thanks!