-
This may sound a bit lame but i just can't seem to figure it out.
I have a list box, two text boxes and a command button.
I want to input two numbers into the text boxes and then press the command button to put the first textbox into a column and then put the second text box into the second column.
Each time i put more data into the text boxes i want it to place the data in the same two columns but below the previous data.
Thanks...
-
Don't use a multi column listbox but set a tabstop in the listbox instead.
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 As Long = &H192
Private Sub Form_Load()
'you may want to change this value if you want the
'tabstop closer or further away
Const lTabStop As Long = 127&
'Clear any existing tabs
'and set the list tabstop
SendMessage List1.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&
SendMessage List1.hwnd, LB_SETTABSTOPS, 1&, lTabStop
List1.Refresh
End Sub
Private Sub Command1_Click()
List1.AddItem Text1 & vbTab & Text2
End Sub
Good luck!