I have downloaded a dll for a custom base Winforms as my base form, the developer of the custom form is no longer available and all of my forms inherits on this base form as it has some functionalities common to all of my other forms, my problem here is that the event when I press the ESC key exits or closes the active form immediately without a warning, I wanted to override the keydown event of the ESC key but it does not work. I tried this code below but they are not working, When I press ESC the form closes since the ESC Event which closes the form is embedded in the custom base form.
Private Sub frmMain_KeyPress(sender As Object, e As KeyPressEventArgs)
If e.KeyChar = Chr(27) Then
e.Handled = True
End If
End Sub
Private Sub frmMain_KeyDown(sender As Object, e As KeyEventArgs)
If e.KeyCode = Keys.Escape Then
e.Handled = True
End If
End Sub