Which listview items are selected?

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

    Which listview items are selected?

    I'm using the following code to act on only the selected items in a
    listview. The items are selected via checkboxes:

    Dim indexes As ListView.Select edIndexCollecti on = .SelectedIndice s
    For Each i In indexes
    ActiveXFileName = .Items(i).ToStr ing
    Call RegisterActiveX File(ActiveXFil eName)
    Next
    For some reason it does not work. Can someone explain why?


    --
    |
    +-- Julian
    |


  • Herfried K. Wagner [MVP]

    #2
    Re: Which listview items are selected?

    "Julian Milano" <jdmils@datafas t.net.au> schrieb:[color=blue]
    > I'm using the following code to act on only the selected items in a
    > listview. The items are selected via checkboxes:
    >
    > Dim indexes As ListView.Select edIndexCollecti on = .SelectedIndice s
    > For Each i In indexes
    > ActiveXFileName = .Items(i).ToStr ing
    > Call RegisterActiveX File(ActiveXFil eName)
    > Next
    > For some reason it does not work. Can someone explain why?[/color]

    \\\
    For Each Item As ListViewItem In Me.ListView1.Ch eckedItems
    Call RegisterActiveX File(Item.Text)
    Next Item
    ///

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

    Comment

    • Rothariger

      #3
      Re: Which listview items are selected?

      i think it is ListView1.Selec tedItems, here you have all the items that youve
      selected.

      "Herfried K. Wagner [MVP]" wrote:
      [color=blue]
      > "Julian Milano" <jdmils@datafas t.net.au> schrieb:[color=green]
      > > I'm using the following code to act on only the selected items in a
      > > listview. The items are selected via checkboxes:
      > >
      > > Dim indexes As ListView.Select edIndexCollecti on = .SelectedIndice s
      > > For Each i In indexes
      > > ActiveXFileName = .Items(i).ToStr ing
      > > Call RegisterActiveX File(ActiveXFil eName)
      > > Next
      > > For some reason it does not work. Can someone explain why?[/color]
      >
      > \\\
      > For Each Item As ListViewItem In Me.ListView1.Ch eckedItems
      > Call RegisterActiveX File(Item.Text)
      > Next Item
      > ///
      >
      > --
      > M S Herfried K. Wagner
      > M V P <URL:http://dotnet.mvps.org/>
      > V B <URL:http://classicvb.org/petition/>
      >[/color]

      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: Which listview items are selected?

        "Rothariger " <Rothariger@msn .com> schrieb:[color=blue]
        >i think it is ListView1.Selec tedItems, here you have all the items that
        >youve
        > selected.[/color]

        I was irritated by the "the items are selected via checkboxes" in the OP's
        post.

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

        Comment

        Working...