need help to resolve concatenation error

Discussion in 'ASP .Net' started by TJS, Jan 16, 2004.

  1. TJS

    TJS Guest

    getting this error when retrieving selected items from a listbox:
    ----------------------------------------------------------------------------
    ---
    BC30452: Operator '&' is not defined for types 'String' and
    'System.Web.UI.WebControls.ListItem'.

    for this code:
    ----------------------
    Dim item As ListItem
    Dim strList As String

    For each item in StudyList.items
    If item.selected then
    strlist &= "<li>" & item 'fails here
    End if
    Next
     
    TJS, Jan 16, 2004
    #1
    1. Advertising

  2. The following line of code should work:

    strlist = strlist & "<li>"

    Hope this helps.

    ~ Celia ~



    "TJS" <> wrote in message
    news:eNYBRW%...
    > getting this error when retrieving selected items from a listbox:
    > --------------------------------------------------------------------------

    --
    > ---
    > BC30452: Operator '&' is not defined for types 'String' and
    > 'System.Web.UI.WebControls.ListItem'.
    >
    > for this code:
    > ----------------------
    > Dim item As ListItem
    > Dim strList As String
    >
    > For each item in StudyList.items
    > If item.selected then
    > strlist &= "<li>" & item 'fails here
    > End if
    > Next
    >
    >
     
    Celia Oblinger, Jan 16, 2004
    #2
    1. Advertising

  3. Try this line:
    strlist &= "<li>" & item.tostring

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net



    "TJS" <> wrote in message
    news:eNYBRW%...
    > getting this error when retrieving selected items from a listbox:
    > --------------------------------------------------------------------------

    --
    > ---
    > BC30452: Operator '&' is not defined for types 'String' and
    > 'System.Web.UI.WebControls.ListItem'.
    >
    > for this code:
    > ----------------------
    > Dim item As ListItem
    > Dim strList As String
    >
    > For each item in StudyList.items
    > If item.selected then
    > strlist &= "<li>" & item 'fails here
    > End if
    > Next
    >
    >
     
    Steve C. Orr [MVP, MCSD], Jan 16, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. walala
    Replies:
    3
    Views:
    4,874
    walala
    Sep 18, 2003
  2. KK
    Replies:
    4
    Views:
    338
    John Carson
    Dec 3, 2005
  3. Replies:
    1
    Views:
    10,347
  4. willmann817
    Replies:
    5
    Views:
    521
  5. Adebiyi Marion
    Replies:
    1
    Views:
    232
    Rainer Weikusat
    Mar 31, 2013
Loading...

Share This Page