ToolStripTextBox.AcceptsReturn Property

Definition

Gets or sets a value indicating whether pressing ENTER in a multiline TextBox control creates a new line of text in the control or activates the default button for the form.

C#
public bool AcceptsReturn { get; set; }

Property Value

true if the ENTER key creates a new line of text in a multiline version of the control; false if the ENTER key activates the default button for the form. The default is false.

Examples

The following code example demonstrates the syntax for setting various ToolStripTextBox common property settings, including the AcceptsReturn property .

C#
// This code example demonstrates the syntax for setting
// various ToolStripTextBox properties.
// 
toolStripTextBox1.AcceptsReturn = true;
toolStripTextBox1.AcceptsTab = true;
toolStripTextBox1.AutoCompleteCustomSource.AddRange(new string[] {
"This is line one.",
"Second line.",
"Another line."});
toolStripTextBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
toolStripTextBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
toolStripTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
toolStripTextBox1.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
toolStripTextBox1.HideSelection = false;
toolStripTextBox1.MaxLength = 32000;
toolStripTextBox1.Name = "toolStripTextBox1";
toolStripTextBox1.ShortcutsEnabled = false;
toolStripTextBox1.Size = new System.Drawing.Size(100, 25);
toolStripTextBox1.Text = "STRING1\r\nSTRING2\r\nSTRING3\r\nSTRING4";
toolStripTextBox1.TextBoxTextAlign = System.Windows.Forms.HorizontalAlignment.Center;

Remarks

If the value of this property is false, the user must press CTRL+ENTER to create a new line in a multiline ToolStripTextBox control. If there is no default button for the form, then the ENTER key will always create a new line of text in the control, no matter what the value of this property.

Applies to

Produkt Verzie
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10