AcceptsReturn on TextBox not functioning correctly

.net, c#, winforms

Solution

The form has a property called AcceptButton. Is that pointing to the button you are calling the default button?

I just wrote a little test and it seems to work for me.

Problem

I have a simple search field on a form that is set as multiline (which I understand is the only way to change a text box's height) and has the flag AcceptsReturn set to false. However, when I press enter within that control, instead of it activating the default button as it should, it puts in a return character. Now, I've also attempted using the KeyPress event to check if the Enter key has been pressed to activate the search-button click function in the hope that it would override this return behaviour - but it hasn't. Now it just runs the search AND inserts a return character. I'm running Visual Studio 2010 (although this problem seemed to be present in 2008 too before I converted it) and C# .NET 2.0. Any solutions?

Original source