 <p>Why have you declared val and dpayment as strings? If you want them to be numeric types then change the variable declaration and remove the ToString, i.e.</p> <pre><code>int val; double dpayment; dpayment = Convert.ToDouble(dt.Rows[1]["monthlyamount"]); val= Convert.ToInt32( dt.Rows[3]["value"]); </code></pre>