private void txt_UN_Leave(object sender, EventArgs e) { if (txt_UN.Text != "") { EPC_un.SetError(txt_UN, "correct"); EPW_un.Clear(); allcorrect = true; } else if (txt_UN.Text == "") { EPW_un.SetError(txt_UN, "Cannot keep Username blank"); EPC_un.Clear(); allcorrect = false; } }
private void btn_Back_Click(object sender, EventArgs e) { this.Hide(); Login lob = new Login(); lob.Show(); EPW_un.Clear(); EPC_un.Clear(); EPW_pass.Clear(); EPC_pass.Clear(); EPW_pass.Clear(); EPC_pass.Clear(); EPC_email.Clear(); EPW_email.Clear(); EPC_email.Clear(); EPW_email.Clear(); }
private void btn_SignUp_Click(object sender, EventArgs e) { try { string User_Name = txt_UN.Text; string Password = txt_RePassword.Text; string Email = txt_Email.Text; string Password1 = txt_Password.Text; if (User_Name != "" && Password != "" && Password1 != "" && Email != "" && txt_AdminPW.Text == "c#@123.Nibm" && txt_Password.Text == txt_RePassword.Text && allcorrect == true) { SqlConnection con = obj.connect(); con.Open(); string sqlinsert = "insert into Users values('" + User_Name + "','" + Password + "','" + Email + "')"; SqlCommand cmb = new SqlCommand(sqlinsert, con); cmb.ExecuteNonQuery(); MessageBox.Show("Signed up successfully"); con.Close(); this.Hide(); Login ss = new Login(); ss.Show(); } else { MessageBox.Show("Please complete sign up the form correctly"); } EPW_un.Clear(); EPC_un.Clear(); EPW_pass.Clear(); EPC_pass.Clear(); EPW_pass.Clear(); EPC_pass.Clear(); EPC_email.Clear(); EPW_email.Clear(); EPC_email.Clear(); EPW_email.Clear(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }