|
-
Jun 9th, 2003, 02:35 PM
#1
Thread Starter
Junior Member
Formatting a number in a DataGrid column.
Hi
I've been searching through all the posts in this site regarding formatting a number in a datagrid column and I have found some stuff but none of it seems to work for me.
I just need for one column in my datagrid to display as US$ currency (i.e. ###.00).
So far, Ive seen some people say something about a NumberFormat method within the Columns collection in the datagrid, but somehow this collection is not available to me. Others say something about doing the formatting in the SQL statement with which Im getting the data from the SQLDB, but when I tried it just like they said, I get a syntax error saying FORMAT is not a valid command or function.
Anyone know how to do this, or tell me what I may be doing wrong? Thanks!
-
Jul 2nd, 2003, 07:41 PM
#2
Addicted Member
First you need to create a style for the datagrid.
Go to the TableStyles property on the grid. And add a new tablestyle. Making sure the MappingName is set to the name of the table in the dataset that you want to display in this style.
Whilst in the tablestyles dialog box , you can add column styles to the style. - See GridColumnStyles.
Each column must be mapped to a column in the table - so if the column in the tables is called Address then the MappingName must be Address.
And what do you see...
Just above the mappingname property in the column dialogbox is the dreaded Format property so type #0.00 This ensures you have 2 numbers after the decimal point.
Note: You must create columnstyles for all the column you wish to display.
Control Data Systems
www.members.shaw.ca/cdsystems
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|