private void Add_New_FormClosed(object sender, FormClosedEventArgs e) { this.Hide(); Form1R fm = new Form1R(); fm.Show(); }
public void submitEntry() { if (name.Text == "" || address.Text == "" || nic.Text == "" || telephone.Text == "" || mobile.Text == "" || email.Text == "" || (male.Checked == false && female.Checked == false)) { MessageBox.Show("Enter full details"); } else if (IsValidEmail(email.Text) == false) { MessageBox.Show("Invalide Email"); } else if (IsPhoneNumber(mobile.Text) != true) { MessageBox.Show("Invalide Mobile Number"); } else if (IsPhoneNumber(telephone.Text) != true) { MessageBox.Show("Invalide Telephone Number"); } else { try { if (male.Checked == true) { Cgender = "male"; } else if (female.Checked == true) { Cgender = "female"; } con.Open(); String sql = "Insert into customer (Name,Address,Gender,NIC,Telephone,Mobile,Email) values('" + name.Text + "','" + address.Text + "','" + Cgender + "','" + nic.Text + "','" + telephone.Text + "','" + mobile.Text + "','" + email.Text + "')"; SqlDataAdapter sda = new SqlDataAdapter(sql, con); sda.SelectCommand.ExecuteNonQuery(); MessageBox.Show("Data Submitted"); clear(); this.Hide(); Form1R fm = new Form1R(); fm.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.Close(); } } }
private void button2_Click(object sender, EventArgs e) { Form1R cusman = new Form1R(); cusman.Show(); }