Guest User

Untitled

a guest
May 27th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. public partial class Form1 : Form
  2. {
  3.  
  4. MatikkaNero math;
  5. public Form1()
  6. {
  7. InitializeComponent();
  8. math = new MatikkaNero();
  9. }
  10.  
  11. private void comboBox_LaskuToimitus_SelectedIndexChanged(object sender, EventArgs e)
  12. {
  13.  
  14.  
  15. // if (textBox_1 != null && textBox_2 != null)
  16. // {
  17. if (comboBox_LaskuToimitus.SelectedIndex == 0)
  18. {
  19. math.Tulos = math.Summa(math.Luku1, math.Luku2);
  20. textBox_Result.Text = Convert.ToString(math.Tulos);
  21.  
  22.  
  23. } // summa
  24. if (comboBox_LaskuToimitus.SelectedIndex == 1)
  25. {
  26. math.Tulos = math.Erotus(math.Luku1, math.Luku2);
  27. textBox_Result.Text = Convert.ToString(math.Tulos);
  28. } // erotus
  29. if (comboBox_LaskuToimitus.SelectedIndex == 2)
  30. {
  31. math.Tulos = math.Tulo(math.Luku1, math.Luku2);
  32. textBox_Result.Text = Convert.ToString(math.Tulos);
  33.  
  34. } // tulo
  35. if (comboBox_LaskuToimitus.SelectedIndex == 3)
  36. {
  37. math.Tulos = math.Osamaara(math.Luku1, math.Luku2);
  38. textBox_Result.Text = Convert.ToString(math.Tulos);
  39. } // osamäärä
  40. if (comboBox_LaskuToimitus.SelectedIndex == 4)
  41. {
  42. math.Tulos = math.Potenssi(math.Luku1, math.Luku2);
  43. textBox_Result.Text = Convert.ToString(math.Tulos);
  44. } // potenssi
  45.  
  46. //}
  47.  
  48. }
  49.  
  50. private void textBox_1_TextChanged(object sender, EventArgs e)
  51. {
  52.  
  53. math.Luku1 = Convert.ToDouble(textBox_1.Text);
  54.  
  55. // if (comboBox_LaskuToimitus != null && textBox_2 != null)
  56. // {
  57.  
  58.  
  59. // }
  60. }
  61.  
  62. private void textBox_2_TextChanged(object sender, EventArgs e)
  63. {
  64.  
  65. math.Luku2 = Convert.ToDouble(textBox_2.Text);
  66.  
  67.  
  68. // if (textBox_1 != null && comboBox_LaskuToimitus != null)
  69. // {
  70.  
  71. //}
  72. }
Add Comment
Please, Sign In to add comment