Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copying text from multi-selected listbox 1

Status
Not open for further replies.

JTBorton

Technical User
Jun 9, 2008
345
DE
I have two list boxes. One with a list of names to choose from and one to put the names the user chose into. The lists are very long and the user may wish to select a lot of names, so I am using a multi-select list box. However, instead of copying the text of the first and adding it to the second, its adding a bunch of -1's.

With lstContactList
intRow = 0
Do Until intRow > (lstContactList.ListCount - 1)
If .Selected(intRow) = True Then
lstMeetings.AddItem .Selected(intRow)
'.RemoveItem .Selected(intRow)
End If
intRow = intRow + 1
Loop
End With


The .removeitem line does not work either which is why I have disabled it.

 
[blue].Selected[/blue] is True or False. If you add True to your other list it is converted to [blue]1[/blue]. If you want the list item, use [blue].List(intRow)[/blue].

[blue].RemoveItem[/blue] needs an Index number - use intRow instead of the True/False .Selected(introw): [blue].RemoveItem intRow[/blue]

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top