Private Sub Frm_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.Alt AndAlso e.KeyCode = Keys.F4 Then
e.Handled = True
End If
End Sub
in c#
if (e.Alt && e.KeyCode == Keys.F4)
{
e.Handled = true ;
}