Marvin kakuru

Marvin kakuru

  • 1.4k
  • 355
  • 159.9k

Add currency format

Jan 17 2012 6:17 AM
Hi there,

I hope your all alright, I am trying to get my program to add values from textbox1.text and textbox2.text , however the values in question have been arrived at by calculation and they are in currency format how best can I add two values that are in currency format.

Below is code I am using

int ee = System.Convert.ToInt32(textBox1.Text);
  int ff = System.Convert.ToInt32(textBox2.Text);
  int gg = System.Convert.ToInt32(textBox33.Text);
  int hh = System.Convert.ToInt32(textBox32.Text);

  int ii = (ee * gg);
  textBox36.Text = ii.ToString("n0");
  int jj = (ff * hh);
  textBox35.Text = jj.ToString("n0");


  int kk = System.Convert.ToInt32(textBox36.Text);
  int ll = System.Convert.ToInt32(textBox35.Text);
  int mm = (kk + ll);
  textBox34.Text = mm.ToString("n0");

And I getting an error "Input string was not in a correct format."

I will appreciate any assistance


Answers (2)