Hardik Patel

Hardik Patel

  • NA
  • 378
  • 468.5k

Disable Alt+F4 and Esc in VB.net application

Aug 8 2015 2:24 AM
i am using global function to disable alt+F4 and Esc
 
Esc is working but alt is not working. pls help
 
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Escape)
{
MessageBox.Show("sorry you cannot close this form via Esc!!!");
return true;
}
else if (keyData == Keys.Alt)
{
MessageBox.Show("sorry you cannot close this form via Esc!!!");
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
 

Answers (1)