TextBox.AcceptsReturn Eigenschaft

Definition

Dient zum Abrufen oder Festlegen eines Werts, der angibt, ob durch Drücken der EINGABETASTE in einem mehrzeiligen TextBox Steuerelement eine neue Textzeile im Steuerelement erstellt oder die Standardschaltfläche für das Formular aktiviert wird.

public:
 property bool AcceptsReturn { bool get(); void set(bool value); };
public bool AcceptsReturn { get; set; }
member this.AcceptsReturn : bool with get, set
Public Property AcceptsReturn As Boolean

Eigenschaftswert

true wenn die EINGABETASTE eine neue Textzeile in einer mehrzeiligen Version des Steuerelements erstellt; false wenn die EINGABETASTE die Standardschaltfläche für das Formular aktiviert. Der Standardwert lautet false.

Beispiele

Im folgenden Codebeispiel wird ein mehrteiliges TextBox Steuerelement mit vertikalen Bildlaufleisten erstellt. In diesem Beispiel werden die AcceptsTabMehrzeilen-Textfeld-Steuerelemente AcceptsReturnund WordWrap Eigenschaften verwendet, um das Mehrzeilen-Textfeld-Steuerelement zum Erstellen von Textdokumenten nützlich zu machen.

public:
   void CreateMyMultilineTextBox()
   {
      // Create an instance of a TextBox control.
      TextBox^ textBox1 = gcnew TextBox;
      
      // Set the Multiline property to true.
      textBox1->Multiline = true;
      // Add vertical scroll bars to the TextBox control.
      textBox1->ScrollBars = ScrollBars::Vertical;
      // Allow the RETURN key to be entered in the TextBox control.
      textBox1->AcceptsReturn = true;
      // Allow the TAB key to be entered in the TextBox control.
      textBox1->AcceptsTab = true;
      // Set WordWrap to true to allow text to wrap to the next line.
      textBox1->WordWrap = true;
      // Set the default text of the control.
      textBox1->Text = "Welcome!";
   }
public void CreateMyMultilineTextBox()
 {
    // Create an instance of a TextBox control.
    TextBox textBox1 = new TextBox();
       
    // Set the Multiline property to true.
    textBox1.Multiline = true;
    // Add vertical scroll bars to the TextBox control.
    textBox1.ScrollBars = ScrollBars.Vertical;
    // Allow the RETURN key to be entered in the TextBox control.
    textBox1.AcceptsReturn = true;
    // Allow the TAB key to be entered in the TextBox control.
    textBox1.AcceptsTab = true;
    // Set WordWrap to true to allow text to wrap to the next line.
    textBox1.WordWrap = true;
    // Set the default text of the control.
    textBox1.Text = "Welcome!";
 }
Public Sub CreateMyMultilineTextBox()
    ' Create an instance of a TextBox control.
    Dim textBox1 As New TextBox()
    
    ' Set the Multiline property to true.
    textBox1.Multiline = True
    ' Add vertical scroll bars to the TextBox control.
    textBox1.ScrollBars = ScrollBars.Vertical
    ' Allow the RETURN key to be entered in the TextBox control.
    textBox1.AcceptsReturn = True
    ' Allow the TAB key to be entered in the TextBox control.
    textBox1.AcceptsTab = True
    ' Set WordWrap to true to allow text to wrap to the next line.
    textBox1.WordWrap = True
    ' Set the default text of the control.
    textBox1.Text = "Welcome!"
End Sub

Hinweise

Wenn der Wert dieser Eigenschaft lautet false, muss der Benutzer STRG+EINGABETASTE drücken, um eine neue Zeile in einem mehrzeiligen TextBox Steuerelement zu erstellen. Wenn für das Formular keine Standardschaltfläche vorhanden ist, erstellt die EINGABETASTE immer eine neue Textzeile im Steuerelement, unabhängig vom Wert dieser Eigenschaft.

Gilt für: