c# - Validating exact length of value -
i using microsoft visual developer c#. trying validate textbox book code (int) entered 4 characters long. used range validator control so. maximumvalue , minimumvalue properties of range validator made them both equal 4. doesnt seem work. doing wrong?
this simple, should thinking more problem before posting. however, empathize beginner , give couple of solutions.
option 1 - convert string , check it's length;
string myvar = bookcode.tostring() if (myvar.length < 5) // it's good! else // error
option 2 - largest value less ten thousand 9999, 4 digit value.
if (bookcode < 10000) // it's else // it's bad