Advertisement

03.04.2008 at 08:25AM PST, ID: 23213089
[x]
Attachment Details

How to format negative numbers properly in C# and ASP.net

Asked by blouckswwu in Microsoft Visual C#.Net

Tags: Microsoft, Visual Studio, 2003, Negative Number display in ASP.net textbox in C#

FYI...I am still in the learning process in C# so bear with me :-)

I am having a problem with negative numbers showing up strange in ASP textboxes.  I have tried various things to get it to format with the negative number in front or better yet...the amount in ( ) format.  Is there something simple here that I am missing.  I have attached the code that I am using to format this particular text box.  The d_UnmetFedAid is a double var.  I am also taking data from other text boxes and converting them from strings to double's to perform calculations using the double.Parse.

I have also attached a screenshot of what it looks like on the web page.

Thanks for any assistance!Start Free Trial
1:
txt_Data_UnmetAid.Text = String.Format("{0,-10:0.00}",d_UnmetFedAid.ToString());
Attachments:
 
Screen Example
Screen Example
 
[+][-]03.04.2008 at 09:34AM PST, ID: 21043045

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual C#.Net
Tags: Microsoft, Visual Studio, 2003, Negative Number display in ASP.net textbox in C#
Sign Up Now!
Solution Provided By: ZachSmith
Participating Experts: 2
Solution Grade: A
 
 
[+][-]03.04.2008 at 02:23PM PST, ID: 21045787

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 03:22PM PST, ID: 21046227

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.05.2008 at 03:05AM PST, ID: 21049239

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.05.2008 at 09:26AM PST, ID: 21052345

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628