//search by type
        private void button2_Click(object sender, EventArgs e)
        {
            Patient p;

            if (comboBox4.Text == "Normal")
            {
                p = new Normal_patient();
            }
            else
            {
                p = new emergency_patient();
            }
            p.set_type(comboBox4.Text);
            //type
            p.set_search(3);
            dataGridView1.DataSource = p.get_search();
        }
        private void button1_Click(object sender, EventArgs e)

        {
            try
            {
                if (string.IsNullOrWhiteSpace(textBox1.Text) || string.IsNullOrWhiteSpace(textBox3.Text) || string.IsNullOrWhiteSpace(textBox4.Text) || string.IsNullOrWhiteSpace(textBox2.Text) || string.IsNullOrWhiteSpace(textBox2.Text) || string.IsNullOrWhiteSpace(comboBox4.Text) || string.IsNullOrWhiteSpace(comboBox5.Text) || string.IsNullOrWhiteSpace(comboBox3.Text) || string.IsNullOrWhiteSpace(comboBox1.Text) || string.IsNullOrWhiteSpace(comboBox2.Text))
                {
                    throw new AnExep();
                }
                else
                {
                    Patient pAdd;
                    if (comboBox5.SelectedItem.ToString() == "emergency")
                    {
                        pAdd = new emergency_patient();
                        pAdd.set(textBox1.Text, textBox3.Text, textBox4.Text, textBox2.Text, comboBox4.Text, textBox6.Text, "0", comboBox5.Text, comboBox1.Text, comboBox2.Text, comboBox3.Text);
                    }
                    else
                    {
                        pAdd = new Normal_patient();
                        pAdd.set(textBox1.Text, textBox3.Text, textBox4.Text, textBox2.Text, comboBox4.Text, textBox6.Text, textBox5.Text, comboBox5.Text, comboBox1.Text, comboBox2.Text, comboBox3.Text);
                    }
                    pAdd.addp();
                    Patient p = new Patient();
                    p.set_display(2);
                    dataGridView2.DataSource = p.get_display();
                }
            }
            catch (AnExep w)
            {
                w.get_msg();
            }
            catch (Exception)
            {
                MessageBox.Show("Error: you must fill data correctly!");
            }
        }