private void btnLogIn_Click(object sender, EventArgs e) { btnLogIn.Enabled = false; this.Close(); frmLogIn nextForm = new frmLogIn(); nextForm.Show(); nextForm.Left = this.Left; nextForm.Top = this.Top; }
private void btnSignUp_Click(object sender, EventArgs e) { if (txtName.Text == "" || txtSurname.Text == "" || txtPassword.Text == "" || txtConfirmPassword.Text == "" || txtEmail.Text == "" || txtContact.Text == "") { MessageBox.Show("Fill Out All Details!"); txtName.Focus(); return; } if (txtConfirmPassword.Text != txtPassword.Text) { MessageBox.Show("Passwords Not Matching"); txtConfirmPassword.Focus(); return; } DialogResult dialogResult = MessageBox.Show("Confirm this information?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); //Check if cust with same email already exists if (!Customer.checkEmail(txtEmail.Text)) { if (chkTerms.Checked) { Customer cust = new Customer(); cust.setCustID(Customer.getNextID()); cust.setForename(txtName.Text); cust.setSurname(txtSurname.Text); cust.setEmail(txtEmail.Text); cust.setPassword(txtPassword.Text); cust.setContactNo(txtContact.Text); cust.AddCustomer(); MessageBox.Show("Your account has been created! Proceeding to the log in page!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.Hide(); frmLogIn nextForm = new frmLogIn(); nextForm.Show(); nextForm.Left = this.Left; nextForm.Top = this.Top; } else { MessageBox.Show("Check Terms & Conditions"); chkTerms.Focus(); return; } } else { MessageBox.Show("Email Already Taken"); return; } }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Taken from stackOverflow - After closing one form and opening thje other, the second closed and closed the App so i added this var main_form = new frmLogIn(); main_form.Show(); Application.Run(); }