David Laranga

David Laranga

  • NA
  • 5
  • 839

Input String was not in correct Format. Please Help

Oct 12 2015 10:44 PM
This is the line of code where i got the error:

private void txtTaxPer_TextChanged(object sender, EventArgs e)
{
try
{
if (string.IsNullOrEmpty(txtTaxPer.Text))
{
txtTaxAmt.Text = "";
txtTotal.Text = "";
return;
}
txtTaxAmt.Text = Convert.ToInt32((Convert.ToInt32(txtSubTotal.Text) * Convert.ToDouble(txtTaxPer.Text) / 100)).ToString() ;
txtTotal.Text = (Convert.ToInt32(txtSubTotal.Text) + Convert.ToInt32(txtTaxAmt.Text)).ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

Answers (8)