Hi, if im correct in thinking your trying to make columns? yes? The reason by putting space 'chr(32)' wont work is each letter has its own dimensions etc etc you get the idea so nothing can line up directly.
-
Option Explicit
-
Private Const LB_SETTABSTOPS = &H192
-
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As _
-
Long, ByVal wParam As Long, lParam As Any) As Long
-
'//Change OBorder to how many colums you require
-
Const OBorder = 1
-
Private Tabulator(1 To OBorder) As Long
-
-
Private Sub Form_Load()
-
'//If You Change OBorder higher than one than you need to set the left values of the
-
'//Tabulator's array (Ive Inserted a few commented for an example) -
-
Tabulator(1) = 50
-
'Tabulator(2) = 150
-
'Tabulator(3) = 250
-
'//This Will Call the function that will set up the tabstops
-
Call MakeList 'This Subroutine sets the listbox up
-
End Sub
-
-
Private Sub MakeList(lstbx as ListBox)
-
' Clear the ListBox, set new tab stops and add values
-
lstbx.Clear
-
-
SendMessage lstbx.hWnd, _
-
LB_SETTABSTOPS, OBorder, Tabulator(1)
-
End Sub
-
Every column you add (OBorder) you will have to add vbTab inbetween for example if you set OBorder to 3 (4 Columns) you would use this...
-
List1.AddItem "Column1 Text" & vbTab & "Column2 Text" & vbTab & "Column3 Text" & vbTab & "Column4 Text"
Which Would Look Like This:
(Ignore the ____, Just there to show the space between columns)
Column1 Text ____ Column2 Text ____ Column3 Text ____ Column4 Text
Hope This Helps ya
Devon