Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleDefine tabs in a ListBox in Visual Basic .NET
DescriptionThis example shows how to define tabs in a ListBox in Visual Basic .NET
Keywordstab, ListBox, set tabs, defined tabs, VB.NET
CategoriesControls, VB.NET
 
Subroutine SetListBoxTabs defines tabs for a ListBox. It makes a "pinned" array (an array that cannot be moved by Visual Basic) if integers defining the tabs. It uses the SendMessage API function to send the ListBox the LB_SETTABSTOPS message passing it the array. It finishes by freeing the array and refreshing the ListBox.
 
Private Sub SetListBoxTabs(ByVal list_box As ListBox, ByVal _
    tab_stops() As Integer)
    Dim pinned_array As GCHandle = _
        GCHandle.Alloc(tab_stops, GCHandleType.Pinned)
    SendMessage( _
        list_box.Handle, _
        LB_SETTABSTOPS, _
        New IntPtr(tab_stops.Length), _
        pinned_array.AddrOfPinnedObject)
    pinned_array.Free()

    list_box.Refresh()
End Sub
 
 
Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated