Thursday, February 26, 2009

use format codes in report files

the best way to format datetime/number values in an RDL file is with the textbox’s Format property. you use the same format codes that you use in .NET and elsewhere, and you don’t have to worry about null values (null’s appear as empty strings). for example, common date format codes are:

d – 2/26/2009
D – Thursday, February 26, 2009
g – 2/26/2009 11:52am

some number/currency codes:

g – 1234
N – 1,234.00
C – $1234.12

if you forget the codes, you can get the VS2005 to show you them by right-clicking on the textbox and choosing ‘Properties’, going to the ‘Format’ tab, and clicking the ‘…’ button next to ‘Format code’.

No comments: