Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace CtoF
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- double[,] k = new double[4, 4];
- private void button1_Click(object sender, EventArgs e)
- {
- textBox2.Text = (double.Parse(textBox1.Text) * k[comboBox1.SelectedIndex, comboBox2.SelectedIndex]).ToString();
- //if (comboBox1.Text == "feet" && comboBox2.Text == "feet")
- //{
- // double feet = Double.Parse(textBox1.Text);
- // feet = feet * 1;
- // textBox2.Text = feet.ToString();
- //}
- //else if (comboBox1.Text == "feet" && comboBox2.Text == "yard")
- //{
- // double feet = Double.Parse(textBox1.Text);
- // double yard = feet * 0.3333;
- // textBox2.Text = yard.ToString();
- //}
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (comboBox1.Text != "")
- {
- button1_Click(sender, e);
- }
- }
- private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (comboBox2.Text != "")
- {
- button1_Click(sender, e);
- }
- }
- private void textBox2_TextChanged(object sender, EventArgs e)
- {
- }
- private void button2_Click(object sender, EventArgs e)
- {
- Close();
- }
- private void button3_Click(object sender, EventArgs e)
- {
- textBox1.Clear();
- textBox2.Clear();
- comboBox1.Text = "";
- comboBox2.Text = "";
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- //comboBox1.Items.Add("");
- comboBox1.SelectedIndex = 0;
- comboBox2.SelectedIndex = 0;
- k[0, 0] = 1;
- k[0, 1] = 0.3333;
- k[0, 2] = 1.1989;
- k[0, 3] = 0.0001893;
- k[1, 0] = 3.5966;
- k[1, 1] = 0.0005682;
- k[1, 2] = 0.8341;
- k[1, 3] = 0.278;
- k[2, 0] = 1;
- k[2, 1] = 0.0001579;
- k[2, 2] = 1;
- k[2, 3] = 0.0001579;
- k[3, 0] = 1760;
- k[3, 1] = 1760;
- k[3, 2] = 6330;
- k[3, 3] = 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment