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.
Syncfusion Feedback

NegativePatterns

Thread ID:

Created:

Updated:

Platform:

Replies:

6257 Aug 6,2003 12:36 PM UTC Aug 7,2003 09:27 AM UTC Windows Forms 10
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 6, 2003 12:36 PM UTC

(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 02:17 PM UTC

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 04:35 PM UTC

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 04:52 PM UTC

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 05:51 PM UTC

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 05:57 PM UTC

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

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

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 09:26 PM UTC

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

Administrator [Syncfusion]
Replied On August 6, 2003 10:24 PM UTC

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 06:40 AM UTC

ms-help://MS.VSCC/MS.MSDNVS/vblr7/html/vafmtUserDefinedNumericFormats.htm

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

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

CONFIRMATION

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.

Warning Icon 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.Close Icon

;