Community discussion forum

C#+ currency data manipulation

  • 1 year ago

     

    Hi all,

    i have three text boxes first containing "$200", second containing "$500". what i have to do is just display the result after adding these two text box to be displayed in third textbox in form "$700";

    while converting these data from decimal to currency i did:
    decimal dec= string.Format("0:c", price);

    but i couldnot get the reverse .

    actually i want to put the code in textbox value changed event handler.

    Thanks


  • 1 year ago

     

    Hello,

    Please try the following code to convert Currency value to a Decimal value.

    Decimal dec = Decimal.Parse(textBox2.Text,System.Globalization.NumberStyles.Currency);

    this.textBox3.Text = Convert.ToDecimal(dec).ToString();

    I hope this helps.


    Regards,

    Allen

    Allen Smith
    ComponentOne LLC

    www.componentone.com

Post a reply

Enter your message below

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!