Jeff and .NET

The .NET musings of Jeff Putz

Sponsors

News

My Sites

Archives

Windows Forms n00b question about text boxes

OK, Windows apps are obviously more foreign to me than I thought. Is there some property I'm overlooking for text boxes that, when the user presses enter, will fire a particular button press?
Posted: Aug 22 2005, 12:48 PM by Jeff | with 4 comment(s)
Filed under:

Comments

Martin Naughton said:

Hi,

The property is on the Form (AcceptButton), not the TextBox.

Thanks,
Martin
# August 22, 2005 1:04 PM

Jay R. Wren said:

or you can check the keypress event for the textbox and see if it was an enter key.
# August 22, 2005 5:13 PM

Jerry Pisk said:

Except that at least in Win32 the enter key message will never be sent to the edit control unless it is created with ES_WANTRETURN style. I'm thinking .Net's message handling will not be much different from Win32's.
# August 22, 2005 6:03 PM

Lockheed said:

Actually Winforms Textboxen have a property to 'Accept Return' so that they will add a carriage return to the text in the box. Mainly used for multi-line text boxes. Other than that, you can check on keypress for the retrun key being hit.
# August 29, 2005 7:50 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)