Listview item key

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

    #1

    Listview item key

    Assuming lv.items.add(ke y,text, image index)

    In a listview with items and subitems in each row, how do we
    get the key value of the selected row?

    The examples I see check for selectedindices it seems. In
    VB6 I used a API method but surely in .Net there's such a
    inbuilt method?

    Thanks,
    Adam


  • Carlos J. Quintero [VB MVP]

    #2
    Re: Listview item key

    Hi Adam,

    Try with the ListViewItem.Na me property for the selected items.

    --

    Best regards,

    Carlos J. Quintero

    MZ-Tools: Productivity add-ins for Visual Studio
    You can code, design and document much faster:
    MZ-Tools has a single goal: To make your everyday programming life easier. As an add-in to several Integrated Development Environment (IDEs) from Microsoft, MZ-Tools adds new menus and toolbars to them that provide many new productivity features.



    "Adam Honek" <AdamHonek@Webm aster2001.frees erve.co.uk> escribió en el
    mensaje news:uguWRO1YGH A.1016@TK2MSFTN GP03.phx.gbl...[color=blue]
    > Assuming lv.items.add(ke y,text, image index)
    >
    > In a listview with items and subitems in each row, how do we
    > get the key value of the selected row?
    >
    > The examples I see check for selectedindices it seems. In
    > VB6 I used a API method but surely in .Net there's such a
    > inbuilt method?
    >
    > Thanks,
    > Adam
    >[/color]


    Comment

    • Adam Honek

      #3
      Re: Listview item key

      Under which LV event would this go?

      Isn't it better to use the key rather than the name of the 1st column's
      displayed text?

      I need to link the LV to then allow some code that deletes an entry in an
      INI file corresponding to the name of the LV item key.

      Adam

      "Carlos J. Quintero [VB MVP]" <carlosq@NOSPAM sogecable.com> wrote in message
      news:OChRh64YGH A.4920@TK2MSFTN GP02.phx.gbl...[color=blue]
      > Hi Adam,
      >
      > Try with the ListViewItem.Na me property for the selected items.
      >
      > --
      >
      > Best regards,
      >
      > Carlos J. Quintero
      >
      > MZ-Tools: Productivity add-ins for Visual Studio
      > You can code, design and document much faster:
      > http://www.mztools.com
      >
      >
      > "Adam Honek" <AdamHonek@Webm aster2001.frees erve.co.uk> escribió en el
      > mensaje news:uguWRO1YGH A.1016@TK2MSFTN GP03.phx.gbl...[color=green]
      >> Assuming lv.items.add(ke y,text, image index)
      >>
      >> In a listview with items and subitems in each row, how do we
      >> get the key value of the selected row?
      >>
      >> The examples I see check for selectedindices it seems. In
      >> VB6 I used a API method but surely in .Net there's such a
      >> inbuilt method?
      >>
      >> Thanks,
      >> Adam
      >>[/color]
      >
      >[/color]


      Comment

      • Carlos J. Quintero [VB MVP]

        #4
        Re: Listview item key

        Hi Adam,

        ListViewItem.Na me returns the key that you used in the call
        ListView1.Items .Add(key, text,....)

        There is some incoherence because sometimes it is called Key, and sometimes
        name. Do not confuse it with the text.

        --

        Best regards,

        Carlos J. Quintero

        MZ-Tools: Productivity add-ins for Visual Studio
        You can code, design and document much faster:
        MZ-Tools has a single goal: To make your everyday programming life easier. As an add-in to several Integrated Development Environment (IDEs) from Microsoft, MZ-Tools adds new menus and toolbars to them that provide many new productivity features.




        "Adam Honek" <AdamHonek@Webm aster2001.frees erve.co.uk> escribió en el
        mensaje news:O6DYJxAZGH A.1200@TK2MSFTN GP03.phx.gbl...[color=blue]
        > Under which LV event would this go?
        >
        > Isn't it better to use the key rather than the name of the 1st column's
        > displayed text?
        >
        > I need to link the LV to then allow some code that deletes an entry in an
        > INI file corresponding to the name of the LV item key.
        >
        > Adam[/color]


        Comment

        Working...