title: Format Exception with Convert.ToDecimal
body: <p>I keep getting back my own catch statement which is "Invalid numeric format. Please check all entries." when I type in "S" as the Employee Type, "30" for Hours Worked, and "200" for Sales Revenue. I have to calculate the commission and total pay based off the employee type and the data entered under Hours Worked and Sales Revenue. I have been trying to figure this out forever and I don't know why it's happening. I understand that it is a format exception but I'm not understanding why it's giving me this error. It obviously has something to do with the first three variables when I type in the data in the text boxes when running the form. Please help!</p>
  
  <pre><code>private void btnCalculate_Click(object sender, EventArgs e)
      {
          try
          {
              string employeeType = txtEmployeeType.Text;
              decimal hours = Convert.ToDecimal(txtHoursWorked.Text);
              decimal revenue = Convert.ToDecimal(txtSalesRevenue.Text);
              decimal commission = Decimal.Parse(txtSalesCommission.Text);
              decimal totalPay = Decimal.Parse(txtTotalPay.Text);
  
              txtSalesRevenue.Text = revenue.ToString("c");
              txtSalesCommission.Text = commission.ToString("c");
              txtTotalPay.Text = totalPay.ToString("c");
  
              //Employee Types: S   = Salaried Employees
              //                HC  = Hourly Commission Employees
              //                HNC = Hourly Non-Commission Employees  
  
              if (employeeType == "S")
  
              {
                  totalPay = (300 + commission);
                  commission = (revenue * .02m);
              }
  
              else if (employeeType == "HC")
  
              {
                  totalPay = ((12 * hours) + commission);
                  commission = (revenue * .01m);
              }
  
              else if (employeeType == "HNC")
              {
                  totalPay = (16 * hours);
                  commission = (revenue * 0);
              }
          }
  
          catch (FormatException)
          {
              MessageBox.Show(
                  "Invalid numeric format. Please check all entries.",
                  "Entry Error");
          }
          catch (OverflowException)
          {
              MessageBox.Show(
                  "Overflow error. Please enter smaller values.",
                  "Entry Error");
          }
          catch (Exception ex)
          {
              MessageBox.Show(
                  ex.Message,
                  ex.GetType().ToString());                               
          }
          txtTotalPay.Focus();
      }
  
      private void btnExit_Click(object sender, EventArgs e)
      {
          this.Close();
      }
     }
  }
  </code></pre>