I'm having problems with error: input string was not in a correct format. I'm trying to convert curency in datagrid. At point where I get error (this is where I set value to value variable) text variable haves value 22.22 so I don't know what is wrong with format.
public void valute()
{
int rowCount = dataGridView1.RowCount;
decimal value = 0;
for (int i = 0; i < rowCount; i++)
{
string text = dataGridView1.Rows[i].Cells[3].Value.ToString();
if (evro_check.Checked)
dataGridView1.Rows[i].Cells[3].Value = text + " €";
else if (dolar_check.Checked)
{
value = Decimal.Parse(text.Replace(',', '.'), CultureInfo.InvariantCulture);
dataGridView1.Rows[i].Cells[3].Value = value.ToString() + " $";
}
else
{
dataGridView1.Rows[i].Cells[3].Value = value + " £";
}
}
}
EDIT: Right now I'm just adding curency sign and later I'll also change € to $ and thats way I'm using additional variable (value) and not using text for other 2 currencys.