I have two related textbox: sub-total and discount, so that if the sub-total is greater than or equal to 500 the discount will be equal 0.10 I have the following code but when the subtotal textbox is empty the string is in the format wrong.
private void txtsubtotal_TextChanged(object sender, EventArgs e)
{
if (Convert.ToInt32(txtsubtotal.Text) >= 500)
{
txtdescuento.Text = "0.10";
}
else
{
if(Convert.ToInt32(txtsubtotal.Text) <= 499)
{
txtdescuento.Text = "0";
}
else
{
if(txtsubtotal.Text=="")
{
txtdescuento.Text = "0";
}
}