I found this doc (Below) on how to add tabs/columns to a list box but I was wonder also how to do the push button tabs that let you sort the data. For example: In Windows explorier you have sorting tabs that let you sort by name, file size, date, etc...
Can this be done for a list box? if not what else could i use.
This code is from vb-world
Code:Setting Tab Stops in a ListBox Want to create a simple list box that shows several fields of data? The columns property of the list box does not do this, but you can use this function to do it. Public Const LB_SETTABSTOPS As Long = &H192 Public Declare Function SendMessage Lib "user32" Alias _ "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _ ByVal wParam As Long, lParam As Any) As Long Public Sub DoTabs(lstListBox As ListBox, TabArray() As Long) 'clear any existing tabs Call SendMessage(lstListBox.hWnd, LB_SETTABSTOPS, 0&, ByVal 0&) 'set list tabstops Call SendMessage(lstListBox.hWnd, LB_SETTABSTOPS, _ CLng(UBound(TabArray)) + 1, TabArray(0)) End Sub First, set up the columns: Dim Tabs(2) As Long Tabs(0) = 0 Tabs(1) = 100 Tabs(2) = 200 DoTabs List1, Tabs Then, add your items: List1.AddItem "John" & vbTab & "Percival" & vbTab & "Content Editor" List1.AddItem "James" & vbTab & "Limm" & vbTab & "Senior Editor"




Reply With Quote