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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
RBertoraConnect With a Mentor Commented:
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
 
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
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
All Courses

From novice to tech pro — start learning today.