?
Solved

VB 6.0 _Listbox MultiSelect

Posted on 2005-04-23
2
Medium Priority
?
325 Views
Last Modified: 2011-10-03
Hello,

I am tring to use a list box control to with the multiselect property. I will be retriving the values that the user selects. This is a sample of my code. It does not work when user selects multiple items on the listbox.

Dim i As Integer

If List1.ListIndex = -1 Then Exit Sub

For i = List1.ListCount - 1 To 0 Step -1

If List1.Selected(i) = True Then
MsgBox List1
strText = List1
End If
Next i
0
Comment
Question by:jm1576
2 Comments
 
LVL 2

Accepted Solution

by:
ultrapascal earned 2000 total points
ID: 13852165
i think what you like something like that

Dim i As Integer

If List1.ListIndex = -1 Then Exit Sub

For i = List1.ListCount - 1 To 0 Step -1

If List1.Selected(i) = True Then
     List1.ListIndex = i
     
    MsgBox List1.Text
   

End If
Next i
0
 
LVL 12

Expert Comment

by:Bob Lamberson
ID: 13852191
I think you want to add each item to the strText lik this....

Dim i As Integer

If List1.ListIndex = -1 Then Exit Sub

For i = List1.ListCount - 1 To 0 Step -1

If List1.Selected(i) = True Then
MsgBox List1
strText = strText & "," & List1
End If
Next i

Bob
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Simple Linear Regression
Introduction to Processes

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question