I am trying to write a chat room in Dev C++ using the windows forms template. I have it basically working, but I would like to allow the user to press the "enter" key to do the same thing as pressing the button to post their text. I want to make sure this only happens when the one textbox has focus. Also, this should block the "\r\n" added to the textbox. How can I do this?
I use visual studio, but hopefully the concept is the same/similar:
in the properties for the textbox double click on the 'keypress' field. This will create a function for whenever a key is pressed inside the textbox. I think the return key is 13, so use an if statement for when key pressed is 13 and then insert your code for whatever you want it to do.