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 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -