c# - What did I do wrong here? The only error I get is near the bottom. Use of unassigned local variable 'parts' right after "add tax" -


 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

the variable parts has never been assigned value.

assign value before making use of variable. example:

decimal parts = 0; 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -