M
mike
Hi all,
I posted an article regarding with the list box multi-
selection and repost the article with the solution solve.
Actually, I still need help in the list box multi-
selection. I found the solution to get the items that are
selcted from the list box. Now, I'm stuck in extracting
the items and put the items to another array.
My list box have the values in it and all of them is
selected.
User list box:
Last Name | First Name
Doe John
Doe John Jr.
Here is my code to get the selected items
Dim Ctl As Control
Dim varItm As Variant, intI As Integer, i As Integer,
ccount As Integer
Dim str As String, uname(20) As String, uholder(20) as
string
i = 0
ccount = 0
Set Ctl = Me.UserResult
For Each varItm In Ctl.ItemsSelected
For intI = 0 To Ctl.ColumnCount - 1
str = str & " " & Ctl.Column(intI, varItm)
Next intI
uname(i) = str
str = ""
i = i + 1
ccount = ccount + 1
Next varItm
The uname(0) array holds the string value of (Doe John)
and so on. Now, I'm geting stuck on extracting the uname
array and assign it to another array by using the
following code:
For j = 0 To ccount - 1
uholder(j)=Split(uname(j)," ")
** The above line should split the uname array and
assigned the value to uholder array. The result of the
uholder array should be uholder(0)=Doe and uholder(1)
=John. But the code doesn't work. Please help........
Thanks for the help
mike.
I posted an article regarding with the list box multi-
selection and repost the article with the solution solve.
Actually, I still need help in the list box multi-
selection. I found the solution to get the items that are
selcted from the list box. Now, I'm stuck in extracting
the items and put the items to another array.
My list box have the values in it and all of them is
selected.
User list box:
Last Name | First Name
Doe John
Doe John Jr.
Here is my code to get the selected items
Dim Ctl As Control
Dim varItm As Variant, intI As Integer, i As Integer,
ccount As Integer
Dim str As String, uname(20) As String, uholder(20) as
string
i = 0
ccount = 0
Set Ctl = Me.UserResult
For Each varItm In Ctl.ItemsSelected
For intI = 0 To Ctl.ColumnCount - 1
str = str & " " & Ctl.Column(intI, varItm)
Next intI
uname(i) = str
str = ""
i = i + 1
ccount = ccount + 1
Next varItm
The uname(0) array holds the string value of (Doe John)
and so on. Now, I'm geting stuck on extracting the uname
array and assign it to another array by using the
following code:
For j = 0 To ccount - 1
uholder(j)=Split(uname(j)," ")
** The above line should split the uname array and
assigned the value to uholder array. The result of the
uholder array should be uholder(0)=Doe and uholder(1)
=John. But the code doesn't work. Please help........
Thanks for the help
mike.