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 ef5 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { label4.Text = null; label5.Text = null; string s1 = textBox1.Text; string s2 = textBox2.Text; string s3 = textBox3.Text; double a, b, c; if (double.TryParse(s1, out a)) { if (double.TryParse(s2, out b)) { if (double.TryParse(s3, out c)) { if (a > 0.0 && b > 0.0 && c > 0.0) { double P = 2 * a * b + 2 * b * c + 2 * a * c; double V = a * b * c; label4.Text = "P = " + P.ToString(); label5.Text = "V = " + V.ToString(); } else label4.Text = "Liczby powinny być większe od zera"; } else label4.Text = "Niepoprawna liczba!"; } else label4.Text = "Niepoprawna liczba!"; } else label4.Text = "Niepoprawna liczba!"; } private void label2_Click(object sender, EventArgs e) { } private void label4_Click(object sender, EventArgs e) { } } }