(1) I want to show any negative amounts for any number (currency or not currency) as "(100)" instead of "-100"
Which pattern do I change and what do I change it to?
2) On the same note, to get the 1000's separator in non currency number cells, is the currency edit used for to change those non currency numbers too?
AD
Administrator
Syncfusion Team
August 6, 2003 09:17 AM
You can format CellType "TextBox" cells using standard .NET formatting provided you set teh CellValueType to a numeric type.
grid[row, col].CellType = "TextBox";
grid[row, col].CellValueType = typeof(decimal);
grid[row, col].Format = "0.00;(0.00)";
For a CurrencyCell, you use the negative pattern number 4 to see parens.
AD
Administrator
Syncfusion Team
August 6, 2003 11:35 AM
Clay,
That did not work.
It place 0.00(0.00) in my text box. this column is a gridBound. WHen I went to the format drop down box, it only gave me standard types like C, G, etc... none of which do exactly what I want which is a number with commas and parens WITHOUT a $ sign
AD
Administrator
Syncfusion Team
August 6, 2003 11:52 AM
It seems to work for me in the attached sample.
I applied those style setting to the TableStyle so anywhere you type a number in the grid, you will see it displayed to 2 decimal places, and negative numbers will have parens.
If you are seeing 0.00;(0.00) in the cell, then check to make sure you set the Format property and not the Text property. Also make sure the CellValueType and CellType are set as well.
If you are doing this in a GridDataBoundGrid, then you will have to set the style in the GridBoundColumn for you column.
AD
Administrator
Syncfusion Team
August 6, 2003 12:51 PM
If you are tyring to do this from the designer, you can just type the 0.00;(0.00) into the format entry. Here is the designer generated code that worked for me.
//
// gridBoundColumn2
//
this.gridBoundColumn2.HeaderText = "Price";
this.gridBoundColumn2.MappingName = "UnitPrice";
this.gridBoundColumn2.StyleInfo.CellValueType = typeof(System.Double);
this.gridBoundColumn2.StyleInfo.Format = "0.00;(0.00)";
AD
Administrator
Syncfusion Team
August 6, 2003 12:57 PM
Thanks - I removed the column and started fom scratch - it works
AD
Administrator
Syncfusion Team
August 6, 2003 02:26 PM
Wrote a little too soon. with 0.00;(0.00) I get the negative symbol but not the commas for the thousands separator. If I put N i get commas but not negative () parenthesis. I tried N;(N) and that did not work
AD
Administrator
Syncfusion Team
August 6, 2003 04:26 PM
Try "#,###.00;(#,###.00)"
AD
Administrator
Syncfusion Team
August 6, 2003 05:24 PM
Thank you!
Where would I find that in the .NET documentation. I only knew of the String.Format with C, N, X, etc...
AD
Administrator
Syncfusion Team
August 7, 2003 01:40 AM
ms-help://MS.VSCC/MS.MSDNVS/vblr7/html/vafmtUserDefinedNumericFormats.htm
AD
Administrator
Syncfusion Team
August 7, 2003 04:27 AM
Ahh.. thanks. Hmm.. I didn't know VB formatting wsa a "standard" ;)