Introduction

What I build is just a simple calculator that will show beginners how much easy it is to develop applications using the .NET Framework. Through this sample, they will see some most useful algorithmic operations. In addition they will understand how to program buttons and use its properties, specially the object sender which is the first parameter of any click event. In fact, the sender object encapsulate all the control's button properties. Just a casting operation to a Button control will give you access to these properties.

Building the Sample

Are there special requirements or instructions for building the sample?

You will need to have Visual Studio 2012 Express installed or Visual Studio 2012, which you can download them from

http://www.microsoft.com/visualstudio/11/en-us/downloads#vs.

When installed, all you need is to open the .sln file with visual studio and press F5 to run.


Description

  

 

C#
Edit|Remove
private void Button_Click_1(object sender, RoutedEventArgs e) 
        { 
            Button b = (Button) sender; 
            tb.Text += b.Content.ToString(); 
        } 
 
private void Off_Click_1(object sender, RoutedEventArgs e) 
        { 
            //to close the app 
            Application.Current.Shutdown(); 
        }

Source Code Files

More Information

For more information on this application, please feeel free to write in Q&A or to email me via [email protected].

More Code

You can see this same application running on Windows Phone in http://code.msdn.microsoft.com/Windows-Phone-Calculator-6f44a9f2.

Just take a look at this link http://code.msdn.microsoft.com/site/search?f%5B0%5D.Type=User&f%5B0%5D.Value=Houssem%20Dellai .