When I try to print out this it dosen't look as straight and nice as it looks in the listbox. Why?
VB Code:
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
Private Const LB_SETTABSTOPS = &H192
Private Sub Form_Load()
ReDim TabStop(0 To 2) As Long
'assign some values to the tabs for the second third and fourth
'column (the first is flush against the listbox edge)
You have not set any TabStops for the printer (Can you even set TabStops for a printer?).
TabStops are a formatting function. The original data does not change. The Listbox simply moves to the specified column whenever it encounters a Tab character. It does not add spaces.
Try the DrawText API - I know it supports TabStops.
I've run your code and I see what you mean.
I think the problem is that the tabstops you have set in the listbox are not sent to the printer; only the tab characters that you have entered into the listbox text are applied to the printed format.
Here's an example of how to use a ListView in your case. Add Microsoft Windows Common Controls 6 to your project. I haven't tested the printing with a listview though.