private void NewButton_Click(object sender, EventArgs e)
        { // Create new database and set as current.
            if (this.changesMade)
            {
                var confirm = MessageBox.Show("Are you sure? You will lose unsaved changes.", "Confirm New", MessageBoxButtons.YesNo);
                if (confirm == DialogResult.No)
                {
                    return;
                }
            }

            PassBox getPass = new PassBox(this.changesMade);

            getPass.ShowDialog();

            if (getPass.result != "")
            {
                string passwd = getPass.result;
                this.data    = new Data(passwd);
                this.passSet = true;
                this.AddPassButton.Enabled  = false;
                this.SaveButton.Enabled     = true;
                this.changesMade            = true;
                this.listBox1.SelectedIndex = -1;

                this.Populate();
                this.CheckState();
            }
        }
        private void AddPassButton_Click(object sender, EventArgs e)
        { // Add the master password for the current database.
            PassBox getPass = new PassBox(false);

            getPass.ShowDialog();

            if (getPass.result != "")
            {
                string passwd = getPass.result;
                try
                {
                    this.data.SetPassword(passwd);
                }
                catch (System.Security.Cryptography.CryptographicException)
                {
                    MessageBox.Show("Password Incorrect.", "Password Incorrect", MessageBoxButtons.OK);
                    return;
                }
                this.AddPassButton.Enabled = false;
                this.passSet = true;

                this.CheckState();
            }
        }