Ciao, ti premetto che non utilizzo il vb6, ma cercando su internet ho trovato questo post,vedi se può aiutarti:
QuestionHi.
I have a database table (access) with two fields ("FName",Surname").
I want to display these in a listbox with the "FName" in the 1st column of the ListBox and "Surname" in the 2nd column of the ListBox.
Please help me with a piece of code.
Thx for ur help
Answersee the code below and alter it to suit your needs.
Option Explicit
Private Declare Function SendMessageArray Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
Const LB_SETTABSTOPS = &H192
Private Sub Command1_Click()
Dim i As Integer
ReDim LBTab(1) As Long 'for 3 tabs redim LBTab(1 to 3)as long
LBTab(1) = 30
'lbtab(2)=70
'lbtab(3)=100
' Set tab stops, params are Hwnd of list box, number of tabs in array, tab settings array
SendMessageArray List1.hwnd, LB_SETTABSTOPS, 3, LBTab(1)
' Populate listbox with some test data - use vbtab to separate columns
List1.AddItem "Name" & vbTab & "Surname"
List1.AddItem "ravi" & vbTab & "dinesh"
List1.AddItem "shankar" & vbTab & "Poornima"
'you can have loops here
End Sub
[Modificato da acquariusoft 29/02/2008 14:45]
Il mio blog personale http://programmiamo.myblog.it