Set selection in a ListView

  • Thread starter Thread starter Kees van Ginkel
  • Start date Start date
K

Kees van Ginkel

Hello,

I am trying to set the selection in a ListView, but cannot find a proper
method to do this. Is this possible at all ?

Regards,

Kees
 
Assuming that you know the index of the item you wish to select:

The following clears any previous selecteditems (there can be more than one
if you set the Listview that way) , the sets the selected item by index and
then ensures that the selected item will be visible to the user.


lvwShowPlan.SelectedItems.Clear()
lvwShowPlan.Items(piRowNum).Selected = True
lvwShowPlan.Items(piRowNum).EnsureVisible()

Lloyd Sheen
 
* "Kees van Ginkel said:
I am trying to set the selection in a ListView, but cannot find a proper
method to do this. Is this possible at all ?

Set the item's 'Selected' property to 'True'.
 
Back
Top