How to Create Basic Calculator in C#

basic calculator in c#

Basic Calculator- a word which we have heard several times and used it more than 1000 times to calculate, work or entertain. Have you ever wondered that how it works or how can we create a calculator through programming.

In this article we will let you know how to develop and customize a calculator desktop application in visual basic ASP.net using C#.If you are interested in asp.net development, then this software is must. You can download Visual basic by following this link.

All you need to do is to Install visual studio and follow these instructions. We are going to develop a customized calculator app in Windows Form Application.

basic calculator in c#

How to Create Basic Calculator in C#

Start Visual Studio and click Visual C# from left hand sidebar. Then from middle field select the Windows Form Application, change its name, Location and solution name from bottom of the tab according to your preferences or leave it as it is. Before clicking OK please do check that ‘Create Directory for Solution’ is checked and ‘Add to Source Control’ is unchecked. Then click ‘OK’ .

How to Create Basic Calculator in C#

After few seconds, a form will open named as ‘Form1.cs[Design]’ and in this form a window named Form1 will appear. This Form1 window is the design part of our application i.e. ‘Calculator’. For coding part you can double click on this window, a new tab will get open which contains the coding part i.e. Form1.cs.
Now coming to designer part, click on the ToolBox tab align at left hand side of your screen. If not found you can also select it from View tab, 15th from top. Select the required Text Box and Buttons from the given list in the ToolBox Panel. You can drag and drop or double click to get the required tool on your design form. Complete the design as shown in image below or  do it according to your creativity.

How to Create Basic Calculator in C#

After completing the designing phase, double click on any button to get its click event in the coding part.
Do it one by one or simply copy this visual basic 2010 calculator code in the coding part but don’t forget to add the click event in properties tab.

After completing all these steps your Basic Calculator is ready, which Adds, Subtracts, Multiplies and Divide both Integer values as well as Float values.

You can also download the complete Appliction here and Install it in your PC.

Note: Microsoft .Net Framework 4 Client Profile is required to run this Application correctly. Visual Studio Installs this framework by Default.

Download More Source Code Like


About the author

AsadUllah Siddiqui


Leave a Comment