
October 8th, 2004, 08:55 AM
|
|
Registered User
|
|
Join Date: Sep 2004
Posts: 13
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
KeyDown/KeyPress/KeyUp with Enter
I have some problems with dealing with the enter key. The problem is this one:
I have a textbox in a form, and I want to send the information contained in the TextBox when the user presses enter while the TextBox has the focus.
I tried to use the KeyDown event to catch the Keys.Enter key, performing my stuff and setting args.Handled to true. The problem is that the bell rings every time I press Enter in the TextBox.
I am current using the KeyPress event to deal with it, performing my stuff when args.KeyChar =='\r'. What I am thinking is that on other platforms (like the ones with X in their names), this would not work since they are not using '\r' as their end-of-line character. Has anyone experience with this? Is this true? Is there a more portable way?
Thanks in advance
MrKoala
|