Good morning to all, i was just wondering if it's possible to simplify these codes? i have MULTIPLE textboxes with the same textchange event
private void txtOvertimeHours_TextChanged(object sender, EventArgs e)
{
if (txtOvertimeHours.Text.Length <= 0 ||
txtOvertimeHours.Text == null ||
txtOvertimeHours.Text == "0.00" ||
txtOvertimeHours.Text == "0" ||
txtOvertimeHours.Text == "0.0")
{
txtOvertimeHours.Text = "0.00";
}
}
private void txtAllowance_TextChanged(object sender, EventArgs e)
{
if (txtAllowance.Text.Length <= 0 ||
txtAllowance.Text == null ||
txtAllowance.Text == "0.00" ||
txtAllowance.Text == "0" ||
txtAllowance.Text == "0.0")
{
txtAllowance.Text = "0.00";
}
}
//and so on
Aucun commentaire:
Enregistrer un commentaire