Reputation: 4881
In a C# Winforms application, I am using a "toolStripTextBox" toolstrip control to capture some text that is to be used to filter some other content on the form.
The "toolStripTextBox" is selected from a "toolStripSplitButton".
The user can activate the textbox and enter text, but I am struggling to control the end of the user input. What I would like is for the user to press ENTER to complete the input.
I can detect that "ENTER" has been pressed with the key pressed events, but this does not remove the focus away from the text box.
Any ideas?
Upvotes: 2
Views: 2606
Reputation: 498
to send the focus to next control try the below code on same event
e.Handled = true;
System.Windows.Forms.SendKeys.Send("{TAB}"); // optional
Upvotes: 2