How to not close a form when user presses enter key inside a text box?

Update : Try handling the PreviewKeyDown event, too. The MSDN documentation explains it pretty well in the Remarks section. By setting IsInputKey to true, you can override the default behavior so that your TextBox can handle the key.

You'll need to do this in PreviewKeyDown and then handle the key as you already do in KeyDown .

Without trying it myself, I think I would simply set a boolean in the KeyDown of the textbox, then in the Form closing, check for that Boolean and cancel the form closure if it is set (and then reset the boolean).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions