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
Morten Wennevik - 30 Aug 2004 10:40 GMT
Hi Tomasz,
You need to add ListView.
ListView.SelectedListViewItemCollection list = myListView.SelectedItems;
Not sure why though.

Signature
Happy Coding!
Morten Wennevik [C# MVP]
Herfried K. Wagner [MVP] - 30 Aug 2004 11:27 GMT
* "=?Utf-8?B?VG9tYXN6IFphbmlld3NraQ==?=" <Tomasz Zaniewski@discussions.microsoft.com> scripsit:
> 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
[quoted text clipped - 3 lines]
> 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'.

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