15,896,912 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Nav-CProject (Top 7 by date)
Nav-CProject
14-Aug-15 3:45am
View
//This works fine.
var nonintersect = listView1.Items.Cast<ListViewItem>().Except(listView2.Items.Cast<ListViewItem>()).Union(listView2.Items.Cast<ListViewItem>().Except(listView1.Items.Cast<ListViewItem>()));
//The Error occurs in the below code
listView3.Items.AddRange(nonintersect.Select(x => x.Clone()).ToArray());
This is what i have so far. @DamithSL
Nav-CProject
14-Aug-15 3:43am
View
Its giving me 2 errors for listView3.Items.AddRange(nonintersect.Select(x=>x.Clone()).ToArray());
Error Message:
Error 1: The best overloaded method match for 'System.Windows.Forms.ListView.ListViewItemCollection.AddRange(System.Windows.Forms.ListViewItem[])' has some invalid argument
Error 2: Argument 1: cannot convert from 'object[]' to 'System.Windows.Forms.ListViewItem[]'
Nav-CProject
14-Aug-15 3:35am
View
Hi i get this error: An unhandled exception of type 'System.ArgumentException' occurred in System.Windows.Forms.dll
Additional information: Cannot add or insert the item '2' in more than one place. You must first remove it from its current location or clone it.
for: listView3.Items.AddRange(nonintersect.ToArray());
@DamithSL
Nav-CProject
14-Aug-15 3:22am
View
Ahh, i see. Thank you. The code you provided me with does not give me an error. How would i now display the unique numbers in listView3? @DamithSL
Nav-CProject
14-Aug-15 3:17am
View
Error Message: 'System.Windows.Forms.ListView.ListViewItemCollection' does not contain a definition for 'Except' and no extension method 'Except' accepting a first argument of type 'System.Windows.Forms.ListView.ListViewItemCollection' could be found (are you missing a using directive or an assembly reference?) @DamithSL
Nav-CProject
14-Aug-15 3:16am
View
Error here: listView1.Items.Except(listView2)
&
Error here: listView2.Items.Except(listView1)
Nav-CProject
14-Aug-15 3:15am
View
I just used var nonintersect = listView1.Items.Except(listView2).Union(listView2.Items.Except(listView1)); and I'm still having the same error
Show More