Board index » delphi » ????Editing and displaying numbers as percentage????

????Editing and displaying numbers as percentage????

Hi there, i want to know if it is possible to edit and display a numeric
database field as a percentage and if the answer is yes, How?.
example: the field is defined as numeric (4,3)  so a valid number is
0.105 and i want the user to enter 10.5 and see 10.5% .

Any help will be appreciated, thank in advance Esteban.

 

Re:????Editing and displaying numbers as percentage????


Quote
>Hi there, i want to know if it is possible to edit and display a numeric
>database field as a percentage and if the answer is yes, How?.
>example: the field is defined as numeric (4,3)  so a valid number is
>0.105 and i want the user to enter 10.5 and see 10.5% .

Esteban,

You can set DisplayFormat property to ,#0.0% if you have persistent fields.
If you want field / 100 I think you will need a caculated field.

Anderson Franco

Re:????Editing and displaying numbers as percentage????


Have you tried creating a TField object for your field (in the Delphi IDE),
and then setting its DisplayFormat property?

--

Alain Quesnel

P.S.: remove the [brackets] from my address when replying by e-mail.

Esteban Caldentey Morales <ecald...@chilesat.net> wrote in message
news:380B892F.DD001638@chilesat.net...

Quote
> Hi there, i want to know if it is possible to edit and display a numeric
> database field as a percentage and if the answer is yes, How?.
> example: the field is defined as numeric (4,3)  so a valid number is
> 0.105 and i want the user to enter 10.5 and see 10.5% .

> Any help will be appreciated, thank in advance Esteban.

Re:????Editing and displaying numbers as percentage????


Quote
>Hi there, i want to know if it is possible to edit and display a numeric
>database field as a percentage and if the answer is yes, How?.
>example: the field is defined as numeric (4,3)  so a valid number is
>0.105 and i want the user to enter 10.5 and see 10.5% .

If you need to move the decimal place you will need to write  OngetText and
OnSetText event handlers for the tfield

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads