Hi,
I need to have 2 colmuns in a listbox......Any ideas how to do that????? Any code is great.....
Printable View
Hi,
I need to have 2 colmuns in a listbox......Any ideas how to do that????? Any code is great.....
Change the Columns property to the amount of columns you want.
hi
if u don't need proper alignment in a listbox you can just use the vbtab separators.. List1.additem "col1" & vbtab & "col2"
If u need more accurate alignment (eg right alignment for numbers) u can try this code that i got somewhere or other. I havent used it in a prog but did see that it worked.
Regards
Stuart
VB Code:
Module Code: code: 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 Form Code: code: Public Function DoTabs(lstListBox As ListBox, TabArray() As Long) 'clear any existing tabs Call SendMessage(List1.hWnd, LB_SETTABSTOPS, 0&, ByVal 0&) 'set list tabstops Call SendMessage(List1.hWnd, LB_SETTABSTOPS, CLng(UBound(TabArray)), TabArray(0)) End Function Private Sub Form_Activate() Dim Tabs(6) As Long, i As Integer 'Set the Tab Spacing for three columns Tabs(0) = 10 Tabs(1) = 60 Tabs(2) = 110 'Call the Tab Setting Function DoTabs List1, Tabs List1.AddItem vbTab & "123.45" & vbTab & "4.567" & vbTab & "8888.88" List1.AddItem vbTab & "5.67" & vbTab & "3.000" & vbTab & "7777.99" List1.AddItem vbTab & "12.4" & vbTab & "678.9" & vbTab & "9012.34" End Sub