Keystrokes in Winforms app causing window to close unexpectedly
- by Paul Sasik
I have a strange issue that has arisen recently:
Whenever I enter text, even a single character, into a textbox in any Form in my application it causes the form and its parent to close. I've checked for the following so far:
Errant/mis-assigned event handlers that may be interpreting a keystroke as a Form cancel
I am using keypreview in several windows but debugging shows this to not be a cause
Happens in any form of the application
Happens even with brand new text boxes dropped on the form
Tried removing the WithEvents declaration from text box declarations (VB.NET)
The result is DialogResult.Cancel when I break the code after Show or ShowDialog
The forms do not use AcceptButton or CancelButton properties (set to none)
Note: I am modifying a large codebase with a lot of code that I have yet to touch
What else could be causing this strange behavior?