Export (0) Print
Expand All

ListBox.UseTabStops Property

Gets or sets a value indicating whether the ListBox can recognize and expand tab characters when drawing its strings.

[Visual Basic]
Public Property UseTabStops As Boolean
[C#]
public bool UseTabStops {get; set;}
[C++]
public: __property bool get_UseTabStops();
public: __property void set_UseTabStops(bool);
[JScript]
public function get UseTabStops() : Boolean;
public function set UseTabStops(Boolean);

Property Value

true if the control can expand tab characters; otherwise, false. The default is true.

Example

[Visual Basic, C#, C++] The following example demonstrates how to create a ListBox that displays items with tab characters.

[Visual Basic] 
Private Sub CreateTabStopList()
    Dim listBox1 As New ListBox()
    listBox1.SetBounds(20, 20, 100, 100)

    Dim x As Integer
    For x = 1 To 19
        listBox1.Items.Add(("Item" + ControlChars.Tab + x.ToString()))
    Next x
    ' Make the ListBox display tabs within each item.
    listBox1.UseTabStops = True
    Me.Controls.Add(listBox1)
End Sub

[C#] 
private void CreateTabStopList()
{
    ListBox listBox1 = new ListBox();
    listBox1.SetBounds(20,20,100,100);

    for(int x = 1; x < 20;x++)
    {
        listBox1.Items.Add("Item\t" + x.ToString());
    }
    // Make the ListBox display tabs within each item.
    listBox1.UseTabStops = true;
    this.Controls.Add(listBox1);
}

[C++] 
private:
    void CreateTabStopList() {
        ListBox* listBox1 = new ListBox();
        listBox1->SetBounds(20, 20, 100, 100);

        for (int x = 1; x < 20;x++) {
            listBox1->Items->Add(
                String::Concat(S"Item\t", __box(x)));
        }
        // Make the ListBox display tabs within each item.
        listBox1->UseTabStops = true;
        this->Controls->Add(listBox1);
    }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

ListBox Class | ListBox Members | System.Windows.Forms Namespace

Show:
© 2015 Microsoft