---
title: "How to remove from one list all the items in another?"  
description: "How to remove from one list all the items in another?"  
author: "Anonymous User"  
published: 2013-06-13  
updated: 2013-06-14  
canonical: https://www.mindstick.com/forum/1077/how-to-remove-from-one-list-all-the-items-in-another  
category: "vb.net"  
tags: ["vb.net"]  
reading_time: 2 minutes  

---

# How to remove from one list all the items in another?

Hi,\
I'm [reading](https://www.mindstick.com/articles/126273/books-commonly-found-on-college-reading-lists) a set of rows from a [remote database](https://www.mindstick.com/articles/12843/reasons-why-hiring-remote-database-consulting-services-is-the-hottest-industry-trend), and a similar set from a [local database](https://www.mindstick.com/forum/159377/how-to-add-edit-retrieve-data-using-local-database-file-in-microsoft-visual-studio-2012), and then using RemoveAll to get rid of remote rows that are [already](https://yourviews.mindstick.com/view/88453/the-hidden-ways-ai-is-already-controlling-your-daily-life) [present](https://answers.mindstick.com/qa/96635/explain-about-the-various-features-present-in-ms-access) locally...\

```
remote_events = (From a In remote.Events                          Where ...etc...).ToListlocal_events = (From a In local.Events                            Where ...etc...).ToListremote_events.RemoveAll(Function (ByVal event_row As Remote_Event)    (From a In local_events Where a.Identifier = event_row.Identifier).Count > 0)
```

**\**but this doesn't seem right to me. I don't think I should be counting things when all I really need to do is [check whether](https://www.mindstick.com/forum/157543/write-a-java-program-to-check-whether-a-string-is-a-palindrome) a match exists. I've tried various usages of **IsDBNull** and **IsNothing** but get nonsense. I can't use .Except (as suggested here) because the list [elements](https://www.mindstick.com/forum/1440/wpf-button-with-multiple-text-elements) are not the same type.\
Is there a better way of doing this?\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams) for any recommendations or solutions.

## Replies

### Reply by AVADHESH PATEL

Hi Goti,\
You can compare the Identifier as following line of code\

```
    Remote_Events = (From r_evt In Remote_Events                    Where Not ((From l_evt In Local_Events Select l_evt.Identifier).Contains(r_evt.Identifier))                    Select r_evt).ToList
```

\
I hope this helps and at least moves you in the right direction.\


---

Original Source: https://www.mindstick.com/forum/1077/how-to-remove-from-one-list-all-the-items-in-another

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
