Results 1 to 5 of 5

Thread: [2.0] Double to Currency and back to Double

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Resolved [2.0] Double to Currency and back to Double

    After a double has been formatted to currency, is there no way to convert the currency string back to a double for calculations?

    I though specifying the CultureInfo may help in the conversion but it doesn't.

    Code:
    CultureInfo ci = Thread.CurrentThread.CurrentCulture;
    double d = -56254.3856;
    
    string strInput = String.Format(ci, "{0:c}", d);
    Console.WriteLine(strInput);		// ($56,254.39)
    d = Convert.ToDouble(strInput, ci);		// fails
    Console.WriteLine(d);
    What's the simplest way to do this?
    Last edited by wey97; Jan 25th, 2007 at 11:56 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width