Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
500MB 27GB Web Hosting - $9.95/Month
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleSet tabs in a ListBox to make items line up nicely
KeywordsListBox, tab, tabs, columns
CategoriesControls
 
Use the SendMessage API function to send the LB_SETTABSTOPS message to the ListBox. This functions takes as parameters the number of tabs and an array holding the tabs' positions in pixels.
 
Private Sub Form_Load()
Dim tabs(1 To 2) As Long

    tabs(1) = 20
    tabs(2) = 130

    ' Set the tabs.
    SendMessage List1.hwnd, LB_SETTABSTOPS, 2, tabs(1)
    
    ' Enter some values.
    List1.AddItem "Bacon Burger" & vbTab & "3.00"
    List1.AddItem vbTab & "Tomato" & vbTab & "0.15"
    List1.AddItem vbTab & "Extra Cheese" & vbTab & "0.20"
    List1.AddItem "Large Fries" & vbTab & "0.99"
    List1.AddItem "Medium Softdrink" & vbTab & "1.05"
    List1.AddItem ""
    List1.AddItem "Subtotal" & vbTab & "5.39"
    List1.AddItem "Tax" & vbTab & vbTab & "0.38"
    List1.AddItem "Total" & vbTab & vbTab & "5.77"
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated