I need to associate Ctrl+Z key combination to a custom form action (Undo).
I handle Me.KeyDown
event, but don't receive it each time I press keys. Perhaps it depends of what currently active control in a form I have.
As I read from this article I need to
Private Sub MyForm_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
e.Handled = True
End Sub
but even this event I don't receive but when having some controls focused, but not others.
- More that than, for the TextBoxes I can't modify the text anymore;
- More that than, for the TextBoxes there is a (Windows?) Undo-Redo default mechanism, that should work too.
- What should I do to always recieve the
KeyDown
event on the form?