Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using static System.Runtime.InteropServices.JavaScript.JSType;
- namespace Pacis_WinFormsApp1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- }
- private void textBox2_TextChanged(object sender, EventArgs e)
- {
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void label2_Click(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- string n1 = textBox1.Text;
- string n2 = textBox2.Text;
- if ((!double.TryParse(n1, out double d)) || (!double.TryParse(n2, out double d1)))
- {
- MessageBox.Show("No letters please!");
- textBox1.Clear();
- textBox2.Clear();
- }
- else
- {
- double d3 = d + d1;
- textBox3.Text = d3.ToString();
- }
- }
- private void label3_Click(object sender, EventArgs e)
- {
- }
- private void textBox3_TextChanged(object sender, EventArgs e)
- {
- }
- private void button5_Click(object sender, EventArgs e)
- {
- textBox1.Clear();
- textBox2.Clear();
- textBox3.Clear();
- }
- private void button2_Click(object sender, EventArgs e)
- {
- string n1 = textBox1.Text;
- string n2 = textBox2.Text;
- if ((!double.TryParse(n1, out double d)) || (!double.TryParse(n2, out double d1)))
- {
- MessageBox.Show("No letters please!");
- textBox1.Clear();
- textBox2.Clear();
- }
- else
- {
- double d3 = d - d1;
- textBox3.Text = d3.ToString();
- }
- }
- private void button3_Click(object sender, EventArgs e)
- {
- string n1 = textBox1.Text;
- string n2 = textBox2.Text;
- if ((!double.TryParse(n1, out double d)) || (!double.TryParse(n2, out double d1)))
- {
- MessageBox.Show("ERROR, INVALID INPUT!");
- textBox1.Clear();
- textBox2.Clear();
- }
- else
- {
- double d3 = d * d1;
- textBox3.Text = d3.ToString();
- }
- }
- private void button4_Click(object sender, EventArgs e)
- {
- string n1 = textBox1.Text;
- string n2 = textBox2.Text;
- if ((!double.TryParse(n1, out double d)) || (!double.TryParse(n2, out double d1)))
- {
- MessageBox.Show("No letters please!");
- textBox1.Clear();
- textBox2.Clear();
- }
- else
- {
- if (d1 == 0)
- {
- textBox3.Text = "MATH_ERROR";
- }
- else {
- double d3 = d / d1;
- textBox3.Text = d3.ToString();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement