private void button1_Click(object sender, EventArgs e) { try { int test = Int32.Parse(textBox2.Text); Except exc = new Except(); if (exc.BetweenTest(Convert.ToInt32(textBox2.Text)) == true) { MessageBox.Show("Between 5 and 20"); } else { MessageBox.Show("Not Between 5 and 20"); } CalcMed c = new CalcMed(); MessageBox.Show("Median: " + Convert.ToString(c.calcMed(Convert.ToInt32(textBox2.Text)))); } catch (FormatException) { MessageBox.Show(textBox1.Text + " is not an integer. Try again!!"); } }
private void button1_Click(object sender, EventArgs e) { try { int test = Int32.Parse(textBox2.Text); Except exc = new Except(); if (exc.BetweenTest(Convert.ToInt32(textBox2.Text)) == true) { MessageBox.Show("Between 5 and 20"); } else { MessageBox.Show("Not Between 5 and 20"); } CalcCount c = new CalcCount(); MessageBox.Show(textBox2.Text); } catch { MessageBox.Show(textBox2.Text + " is not an integer, try again please !"); } }
private void button1_Click(object sender, EventArgs e) { try { int test = Int32.Parse(textBox1.Text); Except exc = new Except(); if (exc.BetweenTest(Convert.ToInt32(textBox1.Text)) == true) { MessageBox.Show("Between 5 and 20"); } else { MessageBox.Show("Not Between 5 and 20"); } DehanSum num = new DehanSum(); MessageBox.Show(Convert.ToString(num.generate_number(Convert.ToInt32(textBox1.Text)))); } catch (FormatException) { MessageBox.Show(textBox1.Text + " is not an integer. Try again!!"); } }