Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

listbox help

hello,

i was wondering how would i display the unselected collections of items from a listbox to a label,
instead of displaying the selected item to a label.

ex.
If txtbox.SelectedIndex <> -1 Then

' this mean the items is selected in the listbox,
how do i show the other items in a listbox
to display on a label.

thanks.
[385 byte] By [gizmo12345] at [2007-11-11 10:27:11]
# 1 Re: listbox help
The only thing I could think of is loop through each index in the listbox and see if it is in the collection of selectedindices. If it's not then we know that index is not selected.

With ListBox1
For i As Integer = 0 To .Items.Count - 1
If Not .SelectedIndices.Contains(i) Then
'This item is not selected
Console.WriteLine(.Items.Item(i).ToString)
End If
Next
End With
TwoFaced at 2007-11-11 20:47:44 >