0

I have this code to prevent closing a windows form using Alt + F4

Private Sub Form4_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    If e.Alt = True And e.KeyCode = Keys.F4 Then
        e.Handled = True
    End If
End Sub

I am still looking to prevent the user by pressing the Alt + Tab. I try this code but its not working.

  If e.Alt = True And e.KeyCode = Keys.Tab Then
        e.Handled = True
    End If

and

If e.Alt = True And e.KeyCode = Keys.Escape Then
            e.Handled = True
        End If

Is there any solution on how to prevent these shortcuts functions in vb.net?. Specially the Ctrl + Alt + Del

Morteza Asadi
  • 1,819
  • 2
  • 22
  • 39
Dave
  • 75
  • 1
  • 1
  • 9

0 Answers0