listbox help


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: listbox help

  1. #1
    Join Date
    Feb 2007
    Posts
    8

    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.

  2. #2
    Join Date
    Jan 2007
    Posts
    112
    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.

    Code:
           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

Similar Threads

  1. Replies: 0
    Last Post: 07-06-2006, 10:47 AM
  2. how to bind the listbox and textbox
    By JenHu in forum .NET
    Replies: 1
    Last Post: 06-12-2006, 08:34 PM
  3. Listbox with Checkbox
    By chagen in forum VB Classic
    Replies: 1
    Last Post: 01-02-2006, 02:59 PM
  4. ListBox API
    By Steve J Golem in forum VB Classic
    Replies: 2
    Last Post: 12-09-2000, 11:38 PM
  5. ListBox API
    By Steve J Golem in forum VB Classic
    Replies: 0
    Last Post: 12-09-2000, 10:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center