Dave
Sat Nov 06 22:46:06 CST 2004
How do I code in VB?
"Justin Rogers" wrote:
> 10 numbers or 10 digits?
>
> private bool Validate10Digits(TextBox text) {
> if ( text.Length != 10 ) { return false; } // not 10 of them for sure
> for(int i = 0; i < text.Length; i++) {
> char trans = text[i] - '0';
> if ( trans < 0 || trans > 9 ) { return false; }
> }
>
> return true;
> }
>
> 10 numbers is a variation of the above.
>
> private bool Validate10Numbers(TextBox text) {
> if ( text.Length < 19 ) { return false; } // basic check
> string[] numbers = text.Split(',');
> if ( numbers.Length != 10 ) { return false; }
> for(int i = 0; i < numbers.Length; i++) {
> if ( !ValidateNumber(i) ) { return false;
> }
>
> return true;
> }
>
> ValidateNumber is a variation of Validate10Digits that takes a string instead
> of a TextBox and then removes the initial check.
>
>
> --
> Justin Rogers
> DigiTec Web Consultants, LLC.
> Blog:
http://weblogs.asp.net/justin_rogers
>
> "Dave" <Dave@discussions.microsoft.com> wrote in message
> news:8C071206-9D5D-42E6-8429-4C3C0BD686EE@microsoft.com...
> > How do I make sure that there are 10 numbers in a txtbox?
>
>
>