Cell value not formatting properly

Hi there, I have a cell that doesn''t seem to be formatting the way it should. Here is the GridStyleInfo to string: CellValue = ''67.8'' Font.Size = 10 Font.Bold = True CellValueType = System.Double Format = "C02" From that I would expect to see $67.80 - but it comes out as 67.8. Another cell in the same grid has this style info: CellValue = ''12667.7'' Font.Size = 10 CellValueType = System.Double Format = "#,##0.00" It formats correctly, as 12,667.70. I notice that the CellValue has in front of it and the problem one does not - is this the reason? Any ideas what I might be doing wrong? Cheers, TERRY ROSSOW

1 Reply

AD Administrator Syncfusion Team June 13, 2006 04:09 AM UTC

Hi Terry, The reason is that you are assigning the string value to the cell in a grid. You need to assign the double value to the cell in a grid. Here is a code snippet. // 68.7 is the double value. this.gridControl1[3,3].CellValue = 68.7; this.gridControl1[3,3].CellValueType = typeof(System.Double); this.gridControl1[3,3].Format = "C02"; Let me know if this helps. Best Regards, Haneef

Loader.
Up arrow icon