Option Explicit
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 Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim nTabArray(1) As Long 'Two tab stops (= 3 columns)
Const LB_SETTABSTOPS As Long = &H192
nTabArray(0) = 33
nTabArray(1) = 210
'Clear any existing tabs
'and set the list tabstops
Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&)
Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 2&, nTabArray(0))
List1.Refresh
'add some dummy data
List1.AddItem "1" & vbTab & "Apples" & vbTab & "$2.98"
List1.AddItem "2" & vbTab & "Chocolate" & vbTab & "$4.50"
List1.AddItem "3" & vbTab & "Yoghurt" & vbTab & "$4.90"
List1.AddItem "4" & vbTab & "Coffee" & vbTab & "$19.98"
List1.AddItem "5" & vbTab & "Mango" & vbTab & "$2.00"
List1.AddItem "6" & vbTab & "Bananas" & vbTab & "$1.89"
List1.AddItem "7" & vbTab & "Olives" & vbTab & "$7.12"
End Sub
Private Sub List1_Click()
Dim sItems() As String
Dim i As Long
sItems = Split(List1.Text, vbTab)
For i = 0 To 2
Text1(i).Text = sItems(i)
Next
End Sub
how to make that every clicking it can do wrote into the next row with textboxes with next numb er ordinal.
IMO, use a listview instead. It will reduce lots of code and you'll get more advanced features.
Edit:
If you use a listview with gridlines, there is no need for the textbox array. You can make the listview editable by moving a textbox over cells. Search for "editable listview" or something like that.
Last edited by iPrank; May 28th, 2007 at 03:07 PM.
In this case you can calculate the index of current textboxes if you store index of the 'last-textbox' (where you've entered text last time) in some variable.
Hi
Thank you for answer.
Hmm, you would can show an some example because I don't know how I should to do it.
I'm convinced, that it will the best visible on a some example, what about this you think?