Add items to multi-column listbox

meboz

Registered User.
Local time
Today, 09:00
Joined
Aug 16, 2004
Messages
71
Hi all,

Ive looked everywhere but can't find the solution...

How do i add items to a multi-column listbox?

Thankyou in advance
 
meboz,

it's rather easy, you simply delimit each item, with a semicolon...

lstAdd.AddItem "Hello;Wuz Up;Good Bye"

this will add to 3 columns, on ONE row. If you have a 4 column listbox, the 1st 3 will be filled.
If you attempt to add 5 items, only the 1st 4 will populate.

So you must build a string, with data, delimited by a semicolon.


Here's gathering your data, from a multiselect Listbox(lstDisConRst), and adding to a 3 column listbox(lstAdd). Assuming you only choose, 3 items at a time....

Dim x As Integer, s As String

For x = 0 To lstDisConRst.ListCount - 1
If lstDisConRst.Selected(x) = True Then
s = s & lstDisConRst.ItemData(x) & ";"
End If
Next x

I've only been able to fill, one row at a time, (for now)....

Hope this helps, Good Luck!
lstAdd.AddItem Left(s, Len(s) - 1)
 

Users who are viewing this thread

Back
Top Bottom