How to use MaskEdit to ensure a correct number input

Hi!

I am working on a program where I need to be absolutly sure that the number i receive is 11 numbers no more no less.

I have fumbled around with MaskEdit and EDBEditError exceptions, but I am rather uncertain how to use this correctly.

I would like to know if I am all wrong in assuming that I have to use exceptions and how to use them correct.
TheRavenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RBertoraCommented:
you can use a mask edit, make the mask
'999999999' ie 11 numbers..

then you can run a check like

if lenght(Maskedit1.Text) <> 11 then
begin
  //handle the fact that the user has not typed in 11 digits!
end;

Rob ;-)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kretzschmarCommented:
hmm,

if you place a mask like

00000000000

then the user cant leave the field, if there are less than 11 digits entered.

no special check must be done

meikl
0
RBertoraCommented:
Meikl! I always seem to learn something new from you :-)

Raven please reject my answer as Kretzschmars is much neater!
Rob ;-)
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

TheRavenAuthor Commented:
Hi RBertora

Well your answer was'nt that bad, I somehow tried alot of wrong ways to test the length of the text, just not the way you mentioned, so thanks for that.

I was avare of the MaskEdit options explained by Meikl so you gave me more information ;-)

TheRaven
0
RBertoraCommented:
Thanks Raven,
I hope Meikl doesn't feel too bad :-(
Rob ;-)
0
kretzschmarCommented:
nope rob,

i be happy to see you at the top15 soon.
now one step nearer ;-)

meikl
0
RBertoraCommented:
Very happy to hear that
thanks Meikl :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.