In your case I would use a NumericUpDown control. No more need for any validation just set it's Minimum and Maximum properties to the values you need. You cannot even type letters etc. in a NumericUpDown.
Just because the default value is zero it doesn't prevent checking against length. A value of '0' in the box has a length of 1. I can't see the point of checking length anyway. It could be invalid if the length is 0 and if it's greater than zero.
So, to validate the box you must convert to integer as stated earlier. The box may be empty and the conversion will fail so first check the conversion succeeds:
if (int.TryParse(textBox1.Text, out myInt) && (myInt > 0))
// Input is valid
It would certainly help if you gave an example of an input value that was failing.
**how to solve invalid keystore error in android studio here is error report----------------------->
here is error report--------> error:Error:java.lang.RuntimeException: com.android.ide.common.signing.KeytoolException: Failed to read key palash from store "D:\MyApplication3.idea\workspace.xml": Invalid keystore format ...