Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21100

[RESOLVED] Using Clipboard to copy several lines in a MultiSelect Listbox

$
0
0
I have the following code to copy several (more than 1) lines of a listbox with it's MultiSelect property set to 2-Enhanced.
It works, however, it is time consuming when I am using a fairly long list of items (my list1 has 1292 lines--varies within program, but I tested with the 1292 lines).
Is there a faster way to get selected lines (multiple) in a long listbox into memory other than this?

Code:

Dim intCounter As Integer, myString As String
For intCounter = 0 to List1.ListCount - 1  'EDIT: found working backward through list reversed order of lines captured..DUH!
  List1.ListIndex = intCounter
  If List1.Selected(intCounter) = True Then
      myString = myString & List1.Text & vbCr
  End If
Next X
Clipboard.Clear
Clipboard.SetText (myString)


Viewing all articles
Browse latest Browse all 21100

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>