Board index » delphi » Limit decimal place in NUMBER fields

Limit decimal place in NUMBER fields

I need to limit the decimal place entered by the user in NUMBER fielf
(tFloatField). I tried editMak with '####.##' without sucess.

How can i do ?

Thanks in advance.

Marques.

 

Re:Limit decimal place in NUMBER fields


Quote
Marques wrote:

> I need to limit the decimal place entered by the user in NUMBER fielf
> (tFloatField). I tried editMak with '####.##' without sucess.

> How can i do ?

> Thanks in advance.

> Marques.

You could add a handler the OnExit event for that control, and check the
value.  There is a function called FormatFloat that could take the value
entered, check and or return a new formatted value with the correct
decimal position.

Check the Delphi help file for "FormatFloat" ..

Hope that helps!

Rkr
--

          \|||/
          /'^'\
         ( 0 0 )
-----oOOO--(_)--OOOo----------
Reid Roman
E-Mail : rkroman (at) pacbell (dot) net
Delphi Enthusiast, Hobbyist ..
TVisualBasic:=class(None);
U.S.A
------------------------------

Other Threads