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
Loading

Dhaval PatelPosted Jan 17, 2012, 7:55 AM
you are get input string error that means
i think you are pass string value in textbox than this error comes
because are yuo convert all textbox to int32.
Thanks & regards
Dhaval Patel
VulpesPosted Jan 17, 2012, 6:29 AM
Instead of:
textBox1.Text
use:
textBox1.Text.Substring(1).Replace(",", "")