Private Sub DoCalculation() ' Clear the calculator Me.UltraCalculator1.Clear() ' Push each button individually. ' The string passed in is the KEY of the button, not it's text. Me.UltraCalculator1.PushButton("2") Me.UltraCalculator1.PushButton("+") Me.UltraCalculator1.PushButton("3") Me.UltraCalculator1.PushButton("=") ' Result = 5 ' Store displayed value in memory. Me.UltraCalculator1.MemoryStore() ' Memory Value is now 5 ' Clear the calculator Me.UltraCalculator1.Clear() ' Parse string calculation Me.UltraCalculator1.ParseString("6+10=") ' Result = 16 ' Add displayed value to current memory value. Me.UltraCalculator1.MemoryAdd() ' Memory Value is now 21 Me.UltraCalculator1.Clear() Me.UltraCalculator1.MemoryRecall() ' Current value is now 21 Me.UltraCalculator1.BackSpace() ' Current value is now 2 Me.UltraCalculator1.PushButton("+") Me.UltraCalculator1.PushButton("3") Me.UltraCalculator1.PushButton("=") ' Current value is now 5 ' Clear the memory Me.UltraCalculator1.MemoryClear() End Sub
private void DoCalculation() { // Clear the calculator this.ultraCalculator1.Clear(); // Push each button individually. // The string passed in is the KEY of the button, not it's text. this.ultraCalculator1.PushButton("2"); this.ultraCalculator1.PushButton("+"); this.ultraCalculator1.PushButton("3"); this.ultraCalculator1.PushButton("="); // Result = 5 // Store displayed value in memory. this.ultraCalculator1.MemoryStore(); // Memory Value is now 5 // Clear the calculator this.ultraCalculator1.Clear(); // Parse string calculation this.ultraCalculator1.ParseString("6+10="); // Result = 16 // Add displayed value to current memory value. this.ultraCalculator1.MemoryAdd(); // Memory Value is now 21 this.ultraCalculator1.Clear(); this.ultraCalculator1.MemoryRecall(); // Current value is now 21 this.ultraCalculator1.BackSpace(); // Current value is now 2 this.ultraCalculator1.PushButton("+"); this.ultraCalculator1.PushButton("3"); this.ultraCalculator1.PushButton("="); // Current value is now 5 // Clear the memory this.ultraCalculator1.MemoryClear(); }