How to avoid duplicated in a ListView

  • Thread starter Thread starter Just Me
  • Start date Start date
J

Just Me

I want to be sure there are no duplicate nodes in a ListView so before I add
a new node I want to check to see it a similar node has been previously
added.

Is there an easy way to do that or do I have to loop thought all the nodes
comparing each to the new node?

I tried to use "listviewX.Contains" to do this and couldn't get it to work
but maybe I didn't do it correctly.

Thanks
 
Would it be bad to keep track on unique item in ArrayList? You could
use .Contains method to see if the item already exists or not the same
way you tried to do using ListView. But then, why ListView's
Containts() method didn't work, I wonder...
 
I'm not sure what Contains does.

If I create a new node that has identical data as an existing node will
Contains say that the new node is contained?

Thanks
 

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