fursty

kurec#2

Oct 8th, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace CtoF
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18.  
  19. }
  20. double[,] k = new double[4, 4];
  21. private void button1_Click(object sender, EventArgs e)
  22. {
  23. textBox2.Text = (double.Parse(textBox1.Text) * k[comboBox1.SelectedIndex, comboBox2.SelectedIndex]).ToString();
  24. //if (comboBox1.Text == "feet" && comboBox2.Text == "feet")
  25. //{
  26. // double feet = Double.Parse(textBox1.Text);
  27. // feet = feet * 1;
  28. // textBox2.Text = feet.ToString();
  29. //}
  30. //else if (comboBox1.Text == "feet" && comboBox2.Text == "yard")
  31. //{
  32. // double feet = Double.Parse(textBox1.Text);
  33. // double yard = feet * 0.3333;
  34. // textBox2.Text = yard.ToString();
  35. //}
  36.  
  37.  
  38. }
  39. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  40. {
  41. if (comboBox1.Text != "")
  42. {
  43. button1_Click(sender, e);
  44.  
  45. }
  46. }
  47. private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
  48. {
  49. if (comboBox2.Text != "")
  50. {
  51. button1_Click(sender, e);
  52.  
  53. }
  54. }
  55.  
  56. private void textBox2_TextChanged(object sender, EventArgs e)
  57. {
  58.  
  59. }
  60.  
  61. private void button2_Click(object sender, EventArgs e)
  62. {
  63. Close();
  64. }
  65.  
  66. private void button3_Click(object sender, EventArgs e)
  67. {
  68. textBox1.Clear();
  69. textBox2.Clear();
  70. comboBox1.Text = "";
  71. comboBox2.Text = "";
  72. }
  73.  
  74. private void Form1_Load(object sender, EventArgs e)
  75. {
  76. //comboBox1.Items.Add("");
  77. comboBox1.SelectedIndex = 0;
  78. comboBox2.SelectedIndex = 0;
  79. k[0, 0] = 1;
  80. k[0, 1] = 0.3333;
  81. k[0, 2] = 1.1989;
  82. k[0, 3] = 0.0001893;
  83. k[1, 0] = 3.5966;
  84. k[1, 1] = 0.0005682;
  85. k[1, 2] = 0.8341;
  86. k[1, 3] = 0.278;
  87. k[2, 0] = 1;
  88. k[2, 1] = 0.0001579;
  89. k[2, 2] = 1;
  90. k[2, 3] = 0.0001579;
  91. k[3, 0] = 1760;
  92. k[3, 1] = 1760;
  93. k[3, 2] = 6330;
  94. k[3, 3] = 1;
  95.  
  96. }
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103. }
  104. }
Advertisement
Add Comment
Please, Sign In to add comment