//event handler for when the create database button is pressed private void btnCreateDatabase_Click(object sender, EventArgs e) { //if encrypting the database, check if the passwords are equal and display error if they don't match if (chkEncrypt.Checked == true && txtEnterPassword.Text.Equals(txtConfirmPassword.Text) == false) { lblError.Visible = true; } //if not encrypting the database or the passwords match, create the database else { //display error message and quit if error creating database while (Database.createDatabase() == false) { DialogResult result = MessageBox.Show("An Unexpected Error Occurred Creating the Database. Check the Error Log for more detailed information.", "Error Creating Database", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); if (result == DialogResult.Cancel) { Environment.Exit(1); } } //change the password (this action encrypts the database) if (chkEncrypt.Checked == true) { Database.changePassword(Util.escape(txtConfirmPassword.Text)); } lblError.Visible = false; Close(); } }