Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

format numbers with parentheses

 
 
Rob
Guest
Posts: n/a
 
      11-04-2003
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
alignment.

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

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
trick.

How do I align such numbers in .Net?


Thanks,



Rob


 
Reply With Quote
 
 
 
Reply

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...... zheetee@gmail.com ASP .Net 7 05-17-2006 04:44 PM
Why tuples use parentheses ()'s instead of something else like <>'s? seberino@spawar.navy.mil 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



Advertisments