Listbox move multiple selected items to second listbox

  • Thread starter Thread starter K B
  • Start date Start date
K

K B

Hi, The following code has been successful for me in the past and i just
can't figure out where I'm going wrong. When I debug I keep getting the
two top items as selected even though there are not selected and the
selected items are ignored. I'm using ASP.NET 2.0 and using two server
listbox controls. Any help appreciated.
Kit

Dim item As ListItem
Dim check As ListItem
For Each item In lstSelect.Items
If item.Selected = True Then
'check if value already exists in lstTo
check = lstTo.Items.FindByValue(item.Value)
If Not check Is Nothing Then
Exit Sub
Else
lstTo.Items.Add(New ListItem(item.Text, item.Value))
End If
End If
Next
 
Thanks, Alvin. I'm embarrased to say after HOURs of looking at it, that
I realized my test database table had duplicate values...thereby
throwing of the selected items. I hope this posting helps someone else
some day.

thanks again,
kb
 
Back
Top