Hello again.
I have a small problem which I'm having a hard time troubleshooting. I just wanna hear some inputs from you guys. I have like maybe 8 textboxes which all uses the same TextChange Event shown below:
private void TextChangeUpdate(object sender, EventArgs e)
{
if (this.Text.Trim() != "")
{
txtAmountPaid1.Text = (Convert.ToInt32(txtQuantity1.Text) * Convert.ToDecimal(txtUnitPrice1.Text)).ToString();
txtAmountPaid2.Text = (Convert.ToInt32(txtQuantity2.Text) * Convert.ToDecimal(txtUnitPrice2.Text)).ToString();
txtAmountPaid3.Text = (Convert.ToInt32(txtQuantity3.Text) * Convert.ToDecimal(txtUnitPrice3.Text)).ToString();
txtSubtotalProducts.Text = (Convert.ToDecimal(txtAmountPaid1.Text) + Convert.ToDecimal(txtAmountPaid2.Text) + Convert.ToDecimal(txtAmountPaid3.Text)).ToString();
txtSubtotalExpenses.Text = (Convert.ToDecimal(txtWaterBill.Text) + Convert.ToDecimal(txtElectricBill.Text) + Convert.ToDecimal(txtOfficeRent.Text) + Convert.ToDecimal(txtMiscellaneous.Text)).ToString();
txtProductExpenses.Text = txtSubtotalProducts.Text;
txtOtherExpenses.Text = txtSubtotalExpenses.Text;
txtTotalExpenses.Text = (Convert.ToDecimal(txtProductExpenses.Text) + Convert.ToDecimal(txtOtherExpenses.Text)).ToString();
}
}
Now my problem comes in the line:
if (this.Text.Trim() != "")
I need to check which textbox is currently using this Event (TextChangeUpdate). This is because I need to check if the value is equal to "". However, the 'this' keyword doesn't seem to do the job.
Anybody help me please? :) thanks.