Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
the meaning of this code
private void result_Click(object sender, EventArgs e)
       {
           double firstnumber = Convert.ToDouble(txtFirst.Text);
           double secondnumber = Convert.ToDouble(txtSecond.Text);
 
           if (rdbAddition.Checked == false && rdbSubtraction.Checked == false && rdbMultiplication.Checked == false && rdbDivision.Checked == false)
               MessageBox.Show("Please Select Operation Before Calculator", "Message Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
 
           if (rdbAddition.Checked)
           {
               txtAnswer.Text = Convert.ToString(firstnumber + secondnumber);
           }
           else if (rdbSubtraction.Checked)
           {
               txtAnswer.Text = Convert.ToString(firstnumber - secondnumber);
           }
           else if (rdbMultiplication.Checked)
           {
               txtAnswer.Text = Convert.ToString(firstnumber * secondnumber);
           }
           else if (rdbDivision.Checked)
           {
               txtAnswer.Text = Convert.ToString(firstnumber / secondnumber);
           }
Posted 15-Nov-12 1:54am
Ma lavy301
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

It means you have to pick up a beginners book on C# and work through it.
 
All this does is take two numbers that are entered in textboxes, check a few checkboxes to figure out what to do with them and perform the requested operation on those two numbers, storing the result in another textbox.
 
Really, this is bad code for a simple calculator.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

This looks like a simple calculator app in WinForms.
 
It seems to take two numbers - firstnumber and secondnumber (stored as text in two TextBox controls); apply the appropriate arithmetic operation on them (determined by the state of a bunch of RadioButton controls) and store the result in a third TextBox.
 
That's pretty much it.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

The meaning of this bunch of code is like this.
 
There are 2 TextBox accepting numbers, and 4 checkbox/radio button for addition, subtraction, multiplication and division.
 
First you enter some numbers then, this code checks if any of the check box is clicked or not, if no, then show a message "Please Select Operation Before Calculator", and if yes then it does the functionality of addition, subtraction, multiplication, or division accordingly.
 
Hope you understand this code block now.
 
Thanks
Tapan kumar
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 614
1 OriginalGriff 410
2 CPallini 230
3 RyanDev 161
4 Hard_Rockz 125
0 OriginalGriff 5,784
1 Sergey Alexandrovich Kryukov 4,838
2 Peter Leow 3,009
3 Maciej Los 2,894
4 DamithSL 2,465


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 15 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100