class Calculation { // every time you use a comboBox you have to create a load event in order to populate it public static char[] actors = { '+', '-', '*', '/' }; decimal x; decimal y; char actor; decimal result; public Calculation(decimal _x, decimal _y, char _actor) { x = _x; y = _y; actor = _actor; // if actor this then result = add() etc... } public override string ToString() { return String.Format("{0} {1} {2} = {3}", x, actor, y, result); } public decimal add() { return result = x + y; } public decimal subtract() { return result = x - y; } public decimal multiply() { return result = x * y; } public decimal divide() { return result = x / y; } }
if
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)