Retrieving Values from a Multi Select List Box

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Weste

    Retrieving Values from a Multi Select List Box

    I have a multi select list box that is bound to a datatable. I am trying to
    retrieve the user's selections from the list box. I am using the code below.

    foreach (System.Data.Da taRowView item in lstServices.Sel ectedItems)
    {
    MessageBox.Show (item.ToString( ));
    }

    The message box displays System.Data.Dat aRowView. How do I get it to
    display the actual value of the selected item - both the display value and
    the bound value? Thanks for your help.

    Weste
  • Weste

    #2
    RE: Retrieving Values from a Multi Select List Box

    I solved my problem. I changed my code as follows and it worked

    MessageBox.Show (item.Row.ItemA rray[0].ToString()+ " - " +
    item.Row.ItemAr ray[1].ToString());


    "Weste" wrote:
    I have a multi select list box that is bound to a datatable. I am trying to
    retrieve the user's selections from the list box. I am using the code below.
    >
    foreach (System.Data.Da taRowView item in lstServices.Sel ectedItems)
    {
    MessageBox.Show (item.ToString( ));
    }
    >
    The message box displays System.Data.Dat aRowView. How do I get it to
    display the actual value of the selected item - both the display value and
    the bound value? Thanks for your help.
    >
    Weste

    Comment

    Working...