private void btnOk_Click(object sender, EventArgs e)
{
if (!CanPasswordBeEmpty && txtPassword.Text.Length < 1)
{
MessageBox.Show("Password cannot be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
Password = txtPassword.Text;
Canceled = false;
this.Close();
}