/ Forums / Advansys Formativ / Creating Solutions with Formativ / Returning selected value from TrzListView / Reply To: Returning selected value from TrzListView

Support 3

    Use ListItem.SubItems to read the value relate to the column. SubItems is a TStrings (Delphi) which is the base class for objects that represent a list of strings. Some common properties and methods of the SubItems are: count, commatext, text, indexof.

    See the sample code below to read the selected item SubItems value. Index gives the position of the string, where 0 is the position of the first string, 1 is the position of the second string, and so on.

    if (CDIP_FRM.ListView.itemindex < 0) then
      msgbox("Select an item from the list to proceed.")
      exit sub
    end if
    set oListItem = CDIP_FRM.ListView.selected
    msgbox oListItem.Caption & vbcrlf &_
    oListItem.SubItems.Strings(0) & vbcrlf &_

    Hope this helps.

    Advansys Support