TextBox/KeyDown/Enter Key
Greetings,
What is the appropriate way to code a Windows (not WPF) application in C# 3.0 that, when run, accept input to a TextBox after the user hits Enter?
I have a sample program that contains a TextBox and a Button. It uses a KeyDown event for the TextBox and checks that Enter has been pressed. The button's click event sets the TextBox's ReadOnly attribute to false. When I run the program I cannot type anything into the TextBox although the cursor is blinking in the TextBox. Once I click the button I can type into the TextBox and the KeyDown event fires when I hit enter.
The above behavior is not intuitive. One would assume that when the cursor is in a text box that one could enter data. How do I fix the program so I can enter data into the TextBox as soon as the program is run?
Thanks, in advance.
__________________
Sam Stamport
|