PDA

Click to See Complete Forum and Search --> : listbox - AGAIN


JHausmann
Sep 12th, 2000, 05:22 PM
Try different fonts. If the font isn't mono-spaced (same area used by every character), you'll never get it to line up...

Tonatiuh
Sep 14th, 2000, 09:58 AM
But, you can insert Tabs (columns) into your listbox. Use this code:


'This code in Declarations section of the form
private Tabs(2) As Long
private Const LB_SETTABSTOPS As Long = &H192
Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lparam As Any) As Long

'This is the function that insert Tabs in your ListBox
Public Sub DoTabs(lstListBox As ListBox, TabArray() As Long)

'limipia cualquier Tab existente
Call SendMessage(lstListBox.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&)
'Ajusta Tabs
Call SendMessage(lstListBox.hwnd, LB_SETTABSTOPS, CLng(UBound(TabArray)), TabArray(0))

End Sub

'This code in you rForm_Load
Tabs(0) = 0
Tabs(1) = 70
Tabs(2) = 100
DoTabs list1, Tabs

List1.AddItem String1 & vbTab & String2
List1.AddItem String1 & vbTab & String2
List1.AddItem String1 & vbTab & String2
List1.AddItem String1 & vbTab & String2