Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / August 2004

Tip: Looking for answers? Try searching our database.

SelectedListViewItemCollection problems

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tomasz Zaniewski - 30 Aug 2004 10:05 GMT
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/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.