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'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top