Simple Calculator Example in C# Form Application – C# Programming Example
Basic Windows Form

Simple Calculator Example in C# Form Application

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

If you want to make a calculator like as windows calculator click here

1.  Create a New C# Windows Form 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.

%d bloggers like this: