private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (listBox1.SelectedIndex > -1) { if (listBox1.SelectedItem is Tangens) { Tangens o = listBox1.SelectedItem as Tangens; label5.Text = o.Calc().ToString(); } else if (listBox1.SelectedItem is Stepen) { Stepen o = listBox1.SelectedItem as Stepen; label5.Text = o.Calc().ToString(); } else { Minimum o = listBox1.SelectedItem as Minimum; label5.Text = o.Calc().ToString(); } } }
private void button1_Click(object sender, EventArgs e) { double x = Convert.ToDouble(textBox1.Text); if (radioButton1.Checked) { Tangens o = new Tangens(x); listBox1.Items.Add(o); } else if (radioButton2.Checked) { double n = Convert.ToDouble(textBox2.Text); Stepen r = new Stepen(n, x); listBox1.Items.Add(r); } else { double n = Convert.ToDouble(textBox2.Text); double o = Convert.ToDouble(textBox3.Text); Minimum mimi = new Minimum(n, o, x); listBox1.Items.Add(mimi); } }