You need to use AddItem to add the first column, and AddListItem to add the other columns.
AddListItem takes three parameters:
- The text to be added
- The list item ID. This is a unique number which identifies the item; it is essentially a sequence number.
- The column number.
As an example, assume that empno, lastname and firstname are all fields in your employee table. Here's the code:
SELECT Employee
lnI = 1 && this is the list item ID
SCAN
THIS.AddItem(Empno) && 1st col.
THIS.AddListItem(lastname,lnI,2) && 2nd col
THIS.AddListItem(firstname,lnI,3) && 3rd col
lnI = lnI + 1
ENDSCAN
You should also use the ColumnWidths property to make sure that each column in an appropriate width.
By the way, have you by any chance been on one of my courses? The reason I ask is that your example is exactly the same as one that I use to demonstrate listboxes?
Thank you both for those stars. When I first tried to do this, I found the Help totally misleading. It took a lot of trial and error to figure it out, but once you know how, it's quite straightforward.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.