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

StackOverflow https://stackoverflow.com/questions/625993

  •  05-07-2019
  •  | 
  •  

Question

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?

Was it helpful?

Solution

Set "AcceptsReturn" property of the textbox to true.

OTHER TIPS

There is a property on the TextBox control:

textbox1.AcceptsReturn = true;

MSDN documentation

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top