Change your code from
decimal iorigrate=0M;
if(!string.IsNullOrEmpty(dataGridView1.Rows[i].Cells["origrate"].Value.ToString()))
iorigrate =Convert.ToDecimal(dataGridView1.Rows[i].Cells["origrate"].Value);
to:
decimal iorigrate=0M;
if(!string.IsNullOrEmpty(dataGridView1.Rows[i].Cells["origrate"].Value))
iorigrate =Convert.ToDecimal(dataGridView1.Rows[i].Cells["origrate"].Value);
FYI, use
Decimal.TryParse
method instead, to prevent getting these kind of errors.
Here for your reference:
http://msdn.microsoft.com/en-us/library/system.decimal.tryparse.aspx[
^]
Regards,
Eduard