c# - How do I create a box for the user to enter their post code? -
i creating windows application in visual studio using c#.
i want create textbox user type post code. programme needs able verrify valid entry has been entered.
i new programming , have tried searching google got more confused.
this method have used validate british postcode... (note: validate using 3rd party api now)
private bool ispostcode(string text) { var nospace = text.replace(" ", string.empty); if (nospace.length < 6) { return false; } char[] chars = text.tochararray(); if (chars[0] < 'a' || chars[0] > 'z') { return false; } if (chars[1] < 'a' || chars[1] > 'z') { return false; } if (chars[2] < '0' || chars[2] > '9') { return false; } return true; }
Comments
Post a Comment