I set the format of several columns in the initialize layout event of the grid:
For Each MyColumn As UltraGridColumn In e.Layout.Bands(0).ColumnsIf IsNumeric(MyColumn.Key) Then MyColumn.Format = "f2" End If Next
However, when I run the application, the formatting is not displayed. I added a new row to the grid that would display the column format to make sure that it was not lost, and every one still holds the "f2" format. I also applied the format to the summary row and it worked there.
Here is a photo to demonstrate:
That makes sense. The default data type for a column is string and strings do not accept any formatting.
Hi Mike,
.Add("1")
so I changed it to
.Add("1", GetType(Decimal))
and now it works, thanks for all of your help!~Kelly
What is the data type of the column? All the Format property of the column does it call ToString on the Value of a cell and pass in the format you specified. So it looks to me like whatever data type you are using for the columns here, it doesn't support a format of "f2".