I am Beginner here's my code I want to subtract values from one text field to another and show the result in 3rd text field but the problem is that I got the error input string format was not in correct format like that so what should I do?
I think my code is right but I don't know what is happening
private void txt_pay2_TextChanged(object sender, EventArgs e)
{
try
{
if (!string.IsNullOrEmpty(txt_pay2.Text))
{
txt_dues2.Text = (Convert.ToInt32(pay_dues.Text) - Convert.ToInt32(txt_pay2.Text)).ToString();
}
else if (String.IsNullOrEmpty(txt_pay2.Text))
{
MessageBox.Show("Enter A Amount Please !!");
}
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
}