I have the code below which works fine, but if I leave the text boxes blank it throws an error. I would like to first check if any are blank then throw an error message in lblSalary.Text. How could I re-write this? C#
Thanks
protected void Button1_Click(object sender, EventArgs e)
{
Double AnnualHours;
AnnualHours = Convert.ToDouble(txtAnnualHours.Text);
Double Rate;
Rate = Convert.ToDouble(txtRate.Text);
Double Salary;
Salary = (AnnualHours * Rate);
lblSalary.Text = "$" + Salary.ToString();
}
}