SelectedListViewItemCollection problems

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I understand that to get the items that are selected in a listview, you read
the SelectedItems porperty of the list view.

The type of this property is SelectedListViewItemCollection, and this type
is meant to be defined in System.Windows.Forms.dll. But whenever I try use
this type, I get compilation errors saying that the type
SelectedListViewItemCollection is unknown. I have made sure that my solution
has the System.Windows.Forms.dll in its references, and that I am using the
correct using statement (using System.Windows.Forms;) but I still have this
problem.

I am using Framework 1.1. Does anyone know what the problem could be, or if
there is any solution? Is there something wrong with my
System.Windows.Forms.dll assembly?

Thanks
 
Hi Tomasz,

You need to add ListView.

ListView.SelectedListViewItemCollection list = myListView.SelectedItems;

Not sure why though.
 
* "=?Utf-8?B?VG9tYXN6IFphbmlld3NraQ==?= said:
The type of this property is SelectedListViewItemCollection, and this type
is meant to be defined in System.Windows.Forms.dll. But whenever I try use
this type, I get compilation errors saying that the type
SelectedListViewItemCollection is unknown. I have made sure that my solution
has the System.Windows.Forms.dll in its references, and that I am using the
correct using statement (using System.Windows.Forms;) but I still have this
problem.

This type is defined inside the 'ListView' class, so you will have to
type 'ListView.SelectedListViewItemCollection'.
 
Back
Top