Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > format numbers with parentheses

Thread Tools

format numbers with parentheses

Posts: n/a
Hi all,

I want to format right-aligned positive and negative numbers in a grid. My
problem is that I want the negs in parentheses, which is throwing out the

For example, using the format string "#,###.##;(#,###.##)":

Notice how (when viewed with a fixed width font) the close bracket on the
negative number pushes the string to the left by one char and is therefor
throwing the alignment off.

In Excel one can cater for this by using the underscore, followed by the
char you want to allow space for, so my format string would look like this:

This would mean that positive numbers would have the pixels normally
allocated to a right parentheses after them, and positive and negative
numbers would line up perfectly. But .Net doesn't seem to support this

How do I align such numbers in .Net?



Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Can't use parentheses when calling a Sub" help...... ASP .Net 7 05-17-2006 04:44 PM
Why tuples use parentheses ()'s instead of something else like <>'s? Python 44 01-06-2005 10:11 AM
'AddressOf' operand must be the name of a method; no parentheses a =?Utf-8?B?UGF0cmljay5PLklnZQ==?= ASP .Net 15 10-18-2004 11:49 PM
Parentheses in the control expression Memana C++ 1 07-05-2004 02:37 PM
Empty parentheses Christopher Benson-Manica C Programming 10 10-17-2003 09:19 PM