Windows Phone Developers

Monday, April 19, 2010

How to iterate MultiSelect ListBox using C# (.NET)

C# - Get Selected Values from MultiSelect ListBox

Here is a way of retrieving the selected values of Multiselect listbox

for (int i1 = 0; i1 < listBox1.SelectedItems.Count; i1++)
            {
                DataRowView D1 = listBox1.SelectedItems[i1] as DataRowView;

                MessageBox.Show(D1[1].ToString());
            }
The above code uses SelectedItems collection to retrieve information Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

3 comments:

  1. ListBox doesn't contain a definition for SelectedItems.count

    ReplyDelete
  2. Yes it does... but it does not have it for "SelectedItem" (missing "s").

    ReplyDelete
  3. Yes it does, but it does not have it for "SelectedItem" (missing "s")

    ReplyDelete