locked
LISTBOX MULTISELECT??? RRS feed

  • Question

  • hey ,

    i want to know how to use multiselect in listbox??

    for example:

     

    if i have listbox that contain:

    Code Snippet

    saterday

    sunday

    monday

    .....

     

     

     

    and i select both sunday and monday

    the program write to .TEXT file:

    Code Snippet
    days = sunday,monday 

     

     

     

     

    i cant do it??

     

    Friday, September 26, 2008 12:55 PM

Answers

  • Code Snippet

    Dim ListCounter As Integer

    For ListCounter = 0 To ListBox1.SelectedItems.Count - 1

    Console.WriteLine(ListBox1.SelectedItems(ListCounter).ToString)

    Next

     

     

     

    Friday, September 26, 2008 5:25 PM

All replies

  • Which part can't you do? Do you want to retrieve the values of all of the selected items in the ListBox?

     

    Friday, September 26, 2008 1:17 PM
  • yes that's what i want to do

     

    Friday, September 26, 2008 3:35 PM
  • Code Snippet

    Dim ListCounter As Integer

    For ListCounter = 0 To ListBox1.SelectedItems.Count - 1

    Console.WriteLine(ListBox1.SelectedItems(ListCounter).ToString)

    Next

     

     

     

    Friday, September 26, 2008 5:25 PM