.NET TextBox - Handling the Enter Key
问题 What is definitively the best way of performing an action based on the user's input of the Enter key ( Keys.Enter ) in a .NET TextBox , assuming ownership of the key input that leads to suppression of the Enter key to the TextBox itself (e.Handled = true)? Assume for the purposes of this question that the desired behavior is not to depress the default button of the form, but rather some other custom processing that should occur. 回答1: Add a keypress event and trap the enter key