Click to See Complete Forum and Search --> : pressing enter without a button...


carpdog88
January 30th, 2007, 12:39 PM
I want to start an event when the user presses the enter key.

I have it set up like this:

this->AcceptButton = this->enterButton;
...
private: System::Void enterButton_Click(System::Object^ sender, System::EventArgs^ e) {

...


the problem is, this method requires me to have a button visible on the form. How can I do this without the button?

P.S. - I have to do this in .NET -- no MFC please

thanks

carpdog88
January 31st, 2007, 02:19 PM
I tried setting my visible to false for my button, but it doesnt work

Pravin Kumar
February 1st, 2007, 01:37 AM
Hello,

(i) Find the window which receives the ENTER key, (ii) handle WM_CHAR message of that window, (iii) check whether the key pressed is ENTER or not, (iv) if it is, start the event of your choice or (iv) if it is not, execute the default processing of the message.

Do you need a button for this? I doubt.

Regards,
Pravin.

cilu
February 1st, 2007, 01:38 AM
[ redirected ]