ListView Control

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

    ListView Control

    Hello,

    How do I select an Item in a ListView Control.

    I would like to select the item based on the items text.

    Thanks.
    gord.


  • Alex Levi

    #2
    RE: ListView Control

    You can search for the Index of the item that you want to select and use this:

    listView1.Items (Index).Selecte d = True



    "Gordon Marr" wrote:
    [color=blue]
    > Hello,
    >
    > How do I select an Item in a ListView Control.
    >
    > I would like to select the item based on the items text.
    >
    > Thanks.
    > gord.
    >
    >
    >[/color]

    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: ListView Control

      "Gordon Marr" <gmarr6@yahoo.c om> schrieb:[color=blue]
      > How do I select an Item in a ListView Control.
      >
      > I would like to select the item based on the items text.[/color]

      \\\
      Dim lvi As ListViewItem
      For Each lvi In Me.ListView1.It ems
      If lvi.Text = "Foo" Then
      lvi.Selected = True
      End If
      Next lvi
      ///

      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


      Comment

      Working...