-2
 private decimal TaxCharges()
    {
        decimal addTax;
        decimal parts;

        addTax = parts * 0.06m;
        taxTxtBx.Text = addTax.ToString("c");
        return addTax;
    }

unassigned local variable 'parts' right after "addTax = parts

Alan Mederos
  • 61
  • 1
  • 4

2 Answers2

0

The variable parts has never been assigned a value.

Assign it a value before making use of the variable. For example:

decimal parts = 0;
miltonb
  • 6,905
  • 8
  • 45
  • 55
  • That is great. Please accept an answer so that it now shows as a question with an answer (gets it off the unanswered lists). – miltonb Mar 17 '15 at 01:37
0

You need to assign values to the variables in order to initialize them.

E.g.

decimal addTax = 0;

The same with parts needs a value.

Good luck.

Scriptworks
  • 495
  • 1
  • 6
  • 10