February 10, 2016

Multiplication of the values of two textboxes and displaying result in the third textbox

private void txtPRate_TextChanged(object sender, EventArgs e) { Multiply(); } private void Multiply() { int a, b; bool isAValid = int.TryParse(txtPRate.Text, out a); bool isBValid = int.TryParse(txtProductQuantity.Text, out b); if (isAValid && isBValid) txtPAmount.Text = (a * b).ToString(); else txtPAmount.Text = "Invalid input"; } private void txtProductQuantity_TextChanged(object sender, EventArgs e) { Multiply(); }

No comments:

Post a Comment