I need some help, but I do not know how to do this code.
I have a form and in this form I have a button that deletes in a SQL table, I want to make the button disabled and to enable it I want to make the user type a password.
Follow the code of the button that calls the form to enter the password.
private void btnExcluir_Click(object sender, EventArgs e)
{
frmExclusao excluir = new frmExclusao(txtID.Text);
excluir.Show();
}
follows the code of the password form.
private void btn_Ok_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Confirma a exclusão do cadastro", "Atenção", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
{
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "DELETE FROM tbl_amostra WHERE ID = '" + txtID.Text + "'";
cmd.Connection = conex;
conex.Open();
cmd.ExecuteNonQuery();
conex.Close();
}