Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 656139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:40:52+00:00 2026-05-13T22:40:52+00:00

what is the way to avoid the redundancy in the listview when the items

  • 0

what is the way to avoid the redundancy in the listview when the items are added to it..
im using winforms c#.net..
i mean how can i compare between the items in listview1 and items in listview2 so that while adding the items from one listview to another it could not enter the items that are already entered in the target listview..
im able to add items from one listview to other but it is adding auplicate items also what is the way to get rid of it..???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:40:53+00:00Added an answer on May 13, 2026 at 10:40 pm

    You can think of something like:

    Hashtable openWith = new Hashtable();
    // Add some elements to the hash table. There are no 
    // duplicate keys, but some of the values are duplicates.
    openWith.Add("txt", "notepad.exe");
    openWith.Add("bmp", "paint.exe");
    openWith.Add("dib", "paint.exe");
    openWith.Add("rtf", "wordpad.exe");
    // The Add method throws an exception if the new key is 
    // already in the hash table.
    try
    {
        openWith.Add("txt", "winword.exe");
    }
    catch
    {
        Console.WriteLine("An element with Key = \"txt\" already exists.");
    }
    // ContainsKey can be used to test keys before inserting 
    // them.
    if (!openWith.ContainsKey("ht"))
    {
        openWith.Add("ht", "hypertrm.exe");
        Console.WriteLine("Value added for key = \"ht\": {0}", openWith["ht"]);
    }
    

    Now to meet the changes in the problem after edit, you can do it like this:

    if(!ListView2.Items.Contains(myListItem))
    {
        ListView2.Items.Add(myListItem);
    }
    

    You can also refer a similar problem in How to copy the selected items from one listview to another on button click in c#net?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there some way I can define String[int] to avoid using String.CharAt(int) ?
Is there a way to avoid row deletion on an specific table using constrains?
What would be the best way to avoid SQL injection on the C#.net platform.
Is there a way to avoid using @SuppressWarnings below and to keep the same
What's the best way to avoid using GC in D? Is there a way
Careless use of templates can cause bloat. One way to avoid that bloat is
Is there a way to avoid postbacks with gridview every time a row is
Is there an easy way to avoid dealing with text encoding problems?
What is the best way to avoid SQL injection on MSSQL Server from C#
I'm hoping there's a way to avoid custom configuration files if an application runs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.