Freigeben über


TextBoxBase.AcceptsTab-Eigenschaft

Ruft einen Wert ab, der angibt, ob in einem mehrzeiligen Textfeld-Steuerelement beim Drücken der TAB-TASTE ein Tabstoppzeichen in das Steuerelement eingegeben wird oder der Fokus auf das nächste Steuerelement in der Aktivierreihenfolge gesetzt wird, oder legt diesen Wert fest.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Property AcceptsTab As Boolean
'Usage
Dim instance As TextBoxBase
Dim value As Boolean

value = instance.AcceptsTab

instance.AcceptsTab = value
public bool AcceptsTab { get; set; }
public:
property bool AcceptsTab {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_AcceptsTab ()

/** @property */
public void set_AcceptsTab (boolean value)
public function get AcceptsTab () : boolean

public function set AcceptsTab (value : boolean)

Eigenschaftenwert

true, damit Benutzer mit der TAB-TASTE ein Tabstoppzeichen in ein mehrzeiliges Textfeld eingeben können, false, wenn das Drücken der TAB-TASTE den Fokus verschiebt. Der Standardwert ist false.

Hinweise

Wenn die AcceptsTab-Eigenschaft auf true festgelegt ist, müssen Benutzer STRG+TAB drücken, um den Fokus auf das nächste Steuerelement in der Aktivierreihenfolge zu setzen.

Beispiel

Im folgenden Codebeispiel wird mit der abgeleiteten Klasse TextBox ein mehrzeiliges TextBox-Steuerelement mit vertikalen Bildlaufleisten erstellt. In diesem Beispiel werden außerdem die Eigenschaften AcceptsTab, AcceptsReturn und WordWrap verwendet, damit das mehrzeilige Textfeld-Steuerelement zum Erstellen von Textdokumenten eingesetzt werden kann.

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 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!" & Environment.NewLine & "Second Line"
End Sub
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 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!" + Environment.NewLine + "Second Line";
 }
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 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!" + Environment::NewLine + "Second Line";
   }
public void CreateMyMultilineTextBox()
{
    // Create an instance of a TextBox control.
    TextBox textBox1 = new TextBox();
    // Set the Multiline property to true.
    textBox1.set_Multiline(true);
    // Add vertical scroll bars to the TextBox control.
    textBox1.set_ScrollBars(ScrollBars.Vertical);
    // Allow the RETURN key in the TextBox control.
    textBox1.set_AcceptsReturn(true);
    // Allow the TAB key to be entered in the TextBox control.
    textBox1.set_AcceptsTab(true);
    // Set WordWrap to true to allow text to wrap to the next line.
    textBox1.set_WordWrap(true);
    // Set the default text of the control.
    textBox1.set_Text("Welcome!" + Environment.get_NewLine()
        + "Second Line");
} //CreateMyMultilineTextBox

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

TextBoxBase-Klasse
TextBoxBase-Member
System.Windows.Forms-Namespace
TextBox.AcceptsReturn-Eigenschaft