Simple Calculator Example in C# WPF Application – Programming, Pseudocode Example, C# Programming Example
Basic WPF Form

Simple Calculator Example in C# WPF Application

he following C# code is for a simple calculator. In this tutorial we will use Visual Studio and the WPF to build simple calculator that perform addition, subtraction, multiplication and division on floating point number. C# Calculator Example in WPF Form App

1.  Create a New C# Windows WPF Application named similar to MyCalc

2. Design the form similar to that shown above

3. Set the properties of each control on following values

  • TextBox -> txtOperand1
  • TextBox -> txtOperand2
  • TextBox -> txtAnswer
  • Button   -> btnAdd
  • Button   -> btnSubtract
  • Button   -> btnMultiply
  • Button   -> btnDivide

4. Double click on btnAdd and add this code


5. Double click on btnSubtract and add this code


6. Double click on btnMultiply and add this code


7. Double click on btnDivide  and add this code




Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.