When you are working with lots of tables, queries and datasets, you might end up with a lot of those database-related components. And one reason that makes a programmer add all of those components is to just fill in the "DisplayFormat" and "EditFormat" properties of numeric, integer and date fields of a table.
So, to save all those bytes, you can simply do it manually.
TFloatField(Table1.FieldByName('amount')).DisplayFormat := '#,0.00;- #,0.00;0.00';
TFloatField(Table1.FieldByName('amount')).EditFormat := '#0.00';
TFloatField(Table1.FieldByName('amount')).EditFormat := '#0.00';
TFloatField = says the field is of numeric format.
DisplayFormat = to set the field's format when the record is in display/view mode
EditFormat = to set the field's format when the record is in edit and insert mode
#,0.00;- #,0.00;0.00 = the format you can set when on display/view mode. The format for creating a format like this is positive value;negative value;zero or no value separated with semicolon
#0.00 = the format you can set when on edit and insert mode.
RSS Feed 


0 comments:
Post a Comment