We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.


Thread ID:





6257 Aug 6,2003 08:36 AM Aug 7,2003 05:27 AM Windows Forms 10
Tags: GridControl
Administrator [Syncfusion]
Asked On August 6, 2003 08:36 AM

(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?

Administrator [Syncfusion]
Replied On August 6, 2003 10: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.

Administrator [Syncfusion]
Replied On August 6, 2003 12:35 PM

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

Administrator [Syncfusion]
Replied On August 6, 2003 12:52 PM

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.

Administrator [Syncfusion]
Replied On August 6, 2003 01: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)";

Administrator [Syncfusion]
Replied On August 6, 2003 01:57 PM

Thanks - I removed the column and started fom scratch - it works

Administrator [Syncfusion]
Replied On August 6, 2003 03: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

Administrator [Syncfusion]
Replied On August 6, 2003 05:26 PM

Try "#,###.00;(#,###.00)"

Administrator [Syncfusion]
Replied On August 6, 2003 06: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...

Administrator [Syncfusion]
Replied On August 7, 2003 02:40 AM


Administrator [Syncfusion]
Replied On August 7, 2003 05:27 AM

Ahh.. thanks. Hmm.. I didn't know VB formatting wsa a "standard" ;)


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.