|
|
Title | Set tabs in a ListBox to make items line up nicely |
Keywords | ListBox, tab, tabs, columns |
Categories | Controls |
|
|
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
|
|
|
|
|
|