Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4244182
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:40:29+00:00 2026-05-21T03:40:29+00:00

using Silverlight I am having trouble with the following code: CultureInfo culture = new

  • 0

using Silverlight I am having trouble with the following code:

        CultureInfo culture = new CultureInfo("ar-EG");
        CultureInfo invCulture = CultureInfo.InvariantCulture;

        Result.Text = String.Format(culture.NumberFormat, "{0:C}", 70000000.00);

        // Does Not Work
        //Result2.Text = String.Format(invCulture.NumberFormat, "{0}", double.Parse(Result.Text, invCulture));

        // Does Not Work
        //Result2.Text = String.Format(culture.NumberFormat, "{0}", double.Parse(Result.Text, culture.NumberFormat));

        // Does Not Work
        //Result2.Text = Convert.ToString(Decimal.Parse(Result.Text.Replace(" ", ""), NumberStyles.AllowThousands | NumberStyles.AllowDecimalPoint | NumberStyles.AllowCurrencySymbol | NumberStyles.AllowTrailingWhite));

Ultimately I’d like prove that I can transform a number to the Egyptian (Arabic) currency formatted string and then get my original number again.

Any time I try to convert my number back to the original double or decimal I receive an FormatException error ‘Input string was not in a correct format.’.

Any help please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T03:40:30+00:00Added an answer on May 21, 2026 at 3:40 am

    You won’t be able to convert the output string back to a number using double.Parse as that expects the input to be purely numeric.

    If you want the value to go backwards and forwards from a number to a formatted string put the formatting in the XAML:

    <TextBlock Text={Binding NumericValue, StringFormat=c, Mode=TwoWay} />
    

    Source

    Given that you’re not in XAML you’ll need to strip the currency symbol off the text first. You can get the currency symbol from the RegionInfo.CurrencySymbol Property as well as culture.NumberFormat.CurrencySymbol and then remove that from the formatted text before passing to double.Parse.

    As Mr Young points out in his comment, there is an overload of Decimal.Parse that takes a String and IFormatProvider which provide additional information about the string – such as the fact it contains a currency symbol.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Silverlight 4 and am having trouble correctly generating bitmaps from UIElements
I am using silverlight, My code is set up for a usercontrol as follows:
I am new to silverlight and windows phone 7 development and am having some
I'm a newbie to Silverlight and I'm having some trouble finding a solution to
Hello everyone. I'm using Silverlight webbrowser control, and I'm having some problems with that.
Having trouble geting the encoding right in my silverlight application. I need support for
I have using Silverlight and Caliburn Micro and am having a problem getting child
I am having trouble returning multiple entities (eager loading) using the Include() method. I
I'm having trouble getting started, or finding a relevant example, using Azure Blog Storage
I'm having trouble getting my Silverlight app to show in an MVC3 Razor View.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.