This is in C#, but should be easy enough to alter.
It is a bit of a hack to be honest
Declare a member var on the form
private bool ALT_F4 = false;
Handle the form closing event
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (ALT_F4)
{
e.Cancel = true;
return;
}
}
Handle the key down event on the form
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
ALT_F4 =(e.KeyCode.Equals(Keys.F4) && e.Alt == true) ;
}
For Code conversion
Convert C# to VB.NET[
^]