Advertisement
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 up3cc
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- double[,] k = new double[4, 4];
- private void Form1_Load(object sender, EventArgs e)
- {
- comboBox1.Items.Add("ft");
- comboBox1.Items.Add("inch");
- comboBox1.Items.Add("miles");
- comboBox1.Items.Add("yards");
- comboBox1.SelectedIndex = 0;
- comboBox2.Items.Add("ft");
- comboBox2.Items.Add("inch");
- comboBox2.Items.Add("miles");
- comboBox2.Items.Add("yards");
- comboBox2.SelectedIndex = 0;
- k[0, 0] = 1;
- k[0, 1] = 2;
- k[0, 2] = 3;
- k[0, 3] = 4;
- k[1, 0] = 5;
- k[1, 1] = 6;
- k[1, 2] = 7;
- k[1, 3] = 8;
- k[2, 0] = 9;
- k[2, 1] = 10;
- k[2, 2] = 11;
- k[2, 3] = 12;
- k[3, 0] = 13;
- k[3, 1] = 14;
- k[3, 2] = 15;
- k[3, 3] = 16;
- }
- void calc()
- { textBox4.Text = (double.Parse(textBox1.Text) * k[comboBox1.SelectedIndex, comboBox2.SelectedIndex]).ToString(); }
- private void button1_Click(object sender, EventArgs e)
- {
- textBox4.Text = (double.Parse(textBox1.Text) * k[comboBox1.SelectedIndex, comboBox2.SelectedIndex]).ToString();
- }
- private void button2_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
- private void button3_Click(object sender, EventArgs e)
- {
- textBox1.Clear();
- textBox4.Clear();
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (textBox1.Text != "")
- calc();
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- if (textBox1.Text != "")
- calc();
- }
- private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (textBox1.Text != "")
- calc();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement