Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Winforms: prevent button click trigger for a multiline textbox on a "AcceptButton" enabled form?

Well my problem is this: I set the AcceptButton on a form and this gives me the nice effect that it triggers the buttons Click event, but if I'm on a MultiLine textbox I don't want this to happen. Then I just want it to put a enter in it.

Is there any way to do this?

like image 536
Peter Avatar asked Mar 09 '09 12:03

Peter


2 Answers

Set "AcceptsReturn" property of the textbox to true.

like image 154
Xn0vv3r Avatar answered Oct 15 '22 21:10

Xn0vv3r


There is a property on the TextBox control:

textbox1.AcceptsReturn = true;

MSDN documentation

like image 39
Julien Poulin Avatar answered Oct 15 '22 20:10

Julien Poulin