listbox multi-selection

M

mike

Hi all,

In the list box I enable the multi-select to simple and I
can select more than one row in the list box. But how do I
add the selected items to an array of strings?

My list box has the result of:

Last Name | First Name
Doe John
Doe John Jr.

Doe, John should be assign to str(0) (string 1)
Doe, John Jr. Should be assign to str(1)(string 2)

Here is my code.

Dim ctrl As Control
Dim str() as string
dim i as interger

i=0

Set ctrl = Me.UserResult
For Each varItem In ctrl.ItemsSelected
str(i) = ctl.Column(0, varItem) & ","
i=i+1
Next

This code doesn't work and I'm getting errors. The error
is "Run time error'424', object require". How do i add the
selected items and assign it to the strings??

Thanks for the help

mike.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top