TextBox.AcceptsReturn Eigenschap

Definitie

Hiermee wordt een waarde opgehaald of ingesteld die aangeeft of u op Enter drukt in een besturingselement met meerdere regels TextBox een nieuwe tekstregel in het besturingselement maakt of de standaardknop voor het formulier activeert.

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

Waarde van eigenschap

true als met de ENTER-toets een nieuwe regel tekst wordt gemaakt in een versie met meerdere regels van het besturingselement; false als de ENTER-toets de standaardknop voor het formulier activeert. De standaardwaarde is false.

Voorbeelden

In het volgende codevoorbeeld wordt een besturingselement met meerdere regels TextBox gemaakt met verticale schuifbalken. In dit voorbeeld worden de AcceptsTab, AcceptsReturnen WordWrap eigenschappen gebruikt om het besturingselement voor meerdere regels voor tekstvaks nuttig te maken voor het maken van tekstdocumenten.

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

Opmerkingen

Als de waarde van deze eigenschap is false, moet de gebruiker op Ctrl+Enter drukken om een nieuwe regel te maken in een besturingselement met meerdere regels TextBox . Als er geen standaardknop voor het formulier is, maakt de ENTER-toets altijd een nieuwe tekstregel in het besturingselement, ongeacht de waarde van deze eigenschap.

Van toepassing op