I have been trying to capture the enter key in a windows.net textbox but i have no idea how to do it, i googled searched but the only examples i find are visualbasic and c# ones and when i try to do thesame thing in c++ in doesnt work.

I am using visual c++ express 2008 and i am working with windows forms(.net)
I hope thats enough information for you guys to be able to help me.
Thanks in advanced.

Do you want to capture it in place of a button press (like you would in an instant messenger) or...? What were the instructions in C#, perhaps there's a property of the form that's called something different. There's a property where the keypresses from the textbox are also passed down to the form, but I forgot what that one is called.

Yes i want to capture it in place of a button press (like you would in an instant messenger)

Make sure AcceptsEnter is false for the textbox(it is by default). Make a keyDown event for the textbox. Within that event handler have something like

if(e->KeyCode == Keys::Enter)
    button1->PerformClick();

or whatever action you need to take.

Thank you very much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.