private void button2_Click(object sender, EventArgs e) { if (textBox1.TextLength != 0 && textBox2.TextLength != 0 && textBox3.TextLength != 0 && Regex.IsMatch(textBox3.Text.ToString(), @"^(\d{11})$")) { SQLRec.insertPatient(textBox1.Text, textBox2.Text, textBox3.Text); MessageBox.Show("Dodano pacjenta"); this.Controls.Clear(); this.Visible = false; this.Parent.Hide(); textb.Text = "changed"; } else { MessageBox.Show("Brak Danych lub błędny pesel"); } }