Here is my TextChanged
event.
private void Price_Discount_MarginBox_TextChanged(object sender, EventArgs e)
{
if (Convert.ToDecimal(profit_MarginTextBox.Text) > 0)
{
Company_List_PriceTextBox.Text = ((Convert.ToDecimal(list_PriceTextBox.Text) - (Convert.ToDecimal(list_PriceTextBox.Text) * (Convert.ToDecimal(discountTextBox.Text) / 100))) / Convert.ToDecimal(profit_MarginTextBox.Text)).ToString();
}
else
Company_List_PriceTextBox.Text = list_PriceTextBox.Text;
}
The various text boxes are set with a string value of 0.00 unless populated with the data from the bound Data Table
. The textChanged
event is on three different textbox
.
All you have to do is add check a data is valid string or not . if text is null it won't consider null = 0 .
Try this
From your request
Try this