Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get all the values selected in a multiselect ListBox in vb6?

Tags:

listbox

vb6

I have a ListBox on my vb6 project and I've set its property to multiselect. Now, I want to get all of the selected items on my multiselect ListBox and put it in a variable for example, or maybe on a multiline textbox. I just wanted to get the multiselected values.

like image 916
kimbebot Avatar asked Mar 06 '12 07:03

kimbebot


1 Answers

Unfortunately you must loop through all elements. Here is some sample code:

Dim k As Long
Dim s As String

For k = 0 To List1.ListCount - 1
    If List1.Selected(k) Then
        s = List1.List(k)
        ' ... do something
    End If
Next
like image 122
MicSim Avatar answered Nov 10 '22 00:11

MicSim