Marking Duplicates In A List While Not Sorting

Feb 15, 2012

I had a need to mark a listview row if filenames were duplicates for n number of characters from the left. I wrote the following but it smacks of VB6.[code]...

View 5 Replies


ADVERTISEMENT

Remove Duplicates From A List(Of T)?

Feb 23, 2010

I fail to remove duplicates from my List. What am I doing wrong?

Dim Contacts As New List(Of Person)
...
' remove duplicates '

[code].....

View 2 Replies

VS 2005 : Prevent Duplicates In List?

Feb 27, 2011

I am trying to prevent an item from being added to my list this is what i have so far duplicates are being added

HTML
With dtAll
Dim List As New List(Of String)
Dim dtrow As DataRow

[code]....

View 4 Replies

Adding Items To List Results In Duplicates?

Jul 29, 2009

I have this code to return a list of fund sources for our organization.

Dim FundSourceList As New List(Of FundSource)
Dim fs As New FundSource
If results.Count > 0 Then[code].....

The problem is that when I loop through the resulting FundSourceList all it shows is the last value. For example, if I have three fund sources (state, federal, athletic), then when I use this code to loop through all I get listed is athletic, athletic, athletic.

For Each FundSource In FundSources
Debug.Print(FundSource.FundDescription)
Next

So I change the code to this. I moved the creation of the fs variable inside the loop.

Dim results = From result In dsResult.Tables(0) Select result
Dim FundSourceList As New List(Of FundSource)
If results.Count > 0 Then[code]....

This works fine but now I'm creating a new class over and over again. It seems a little inefficient to me. Can I not create the class outside the loop and use it over and over again?

View 3 Replies

Find Duplicates In List(Of String) In Program?

Jun 27, 2012

I have a customers List(of String) on which I am trying to find the duplicate customers.[code]...

View 2 Replies

LINQ VB How To Check For Duplicates In A List Of Objects

Oct 11, 2011

I have a list of objects, each with 2 relevant properties: "ID" and "Name". Lets call the list "lstOutcomes".I need to check the list for duplicates (meaning object1.ID = object2.ID, etc.) and set a flag (valid = false, or something) if there is at least one duplicate. Also, it would be nice to send a message to the user mentioning the "Name" of the object, when it fails.I am sure I will need to use the Group By operator to do this, but I am not used to doing that in LINQ, and the examples out there are just not helping me. This article seems to be close to what i need, but not quite and it's in C#.

Here is a starting stab at it...
Dim duplist = _
(From o As objectType In lstOutcomes _

[code]......
help?

View 4 Replies

VS 2008 Searching List(of String) For Duplicates?

Jun 28, 2010

Okay so i have a very large list of string (500 000 strings) i want to check the number of duplicate strings and maybe even isolate the duplicate strings if i can.

i cant find a fast method to do so :S

i tried using a string array (slower than list) takes ~15mins

i tried using list with the code below takes ~10 mins

that wont cut it :S i need something faster.

[Code]...

View 10 Replies

VS 2010 Searching A List(Of Integer) For Duplicates?

Aug 24, 2009

Is there an easy way to search through a List(Of Integer) and find duplicates? Or do I need to do loops to search through it with each number, comparing it to each one?

View 3 Replies

Find Duplicates Within An Array List Of Random Numbers?

Feb 22, 2012

I'm creating an application that creates a list of 20 ramdomly selected numbers within an array and displaying those numbers in a listbox. I then need to display the duplicate numbers in an adjacent listbox by clicking the find duplicates button. How would I be able to access those 20 numbers in order to find the duplicates?

View 2 Replies

Exception When Sorting List

Jan 29, 2010

I'm trying to sort a List of objects with a generic comparison.I get an exception when the property on which I'm sorting happens to be null in one of the objects.VB.NET 2.0, web.i've read several posts on this exception, and still don't get it.[code]It is true that this only happens on properties which happen to be null somewhere in the list.Sometimes I sort on other properties which happen to always be always non-null (using a different, but similar, comparison method), and this technique works just fine.I've tried to implement the CompareTo for both IComparable and IComparable(of FollowupSurvey) so I could capture this exception while debugging, but netiher actually get invoked (despite what it seems like the exception is telling me). At this point, I don't have a CompareTo in my FollowupSurvey object; thus, it's using Object's.It doesn't seem as if I can really help if the base CompareTo doesn't reutrn 0.anyone have any idea what this exception really means, and how to make sorting work properly?

View 2 Replies

Sorting A List By A Class Value

Jun 25, 2011

I have a list (i.e. Dim nList as new List(of className)). Each class has a property named zIndex (i.e. className.zIndex). Is it possible to sort the elements of the list by the zIndex variable in all of the elements of the list?

View 4 Replies

Sorting A List Of Objects?

Mar 16, 2012

Suppose I have:

Public Class myClass1
Dim foo As String
Dim bar As String

[code].....

View 23 Replies

Sorting Within A List Of Type's?

Jan 30, 2010

I have a simple type like:-

[Code]....

if I have a list of type top_params then how can i sort the list based values in the k_sig_level field?

View 2 Replies

C# - Sorting List Alphabetically And By Type?

Apr 18, 2011

I have a list of instruments and I need to sort them to the following requirement.

order by:

cash
securities in alphabetical order
managed funds in alphabetical order

I have a list of instrument which has properties name and type, I've managed to sort alphabetically by name.

Instruments.Sort(Function(x, y) String.Compare(x.Name, y.Name))
Instruments.Sort((x, y) => string.Compare(x.Name, y.Name));

View 1 Replies

List View Sorting In Vb 2008?

Dec 28, 2009

how we can sort a listview on column wise in a simple way?

View 2 Replies

Return List After Sorting With Repeater?

Jan 5, 2012

I have a list going into a repeater, sorting with jquery sortable(), and then need to put the sorted list into a session variable. I cannot seem to figure out how to get the sorted values back into a list.[code]...

View 1 Replies

Sorting - List.sort Not Working?

Apr 3, 2009

I have a slightly odd problem that I think is most likely due to an act of foolishness on my part, but for the life of me I (and other members of my team) can't see it.I have an object that contains a generic list property which I would like to sort. I have written a comparer class to do this for me and I am calling it in the following way:baseObject.ListOfThings.Sort(new ThingComparer()I have debugged into my compare function and it is returning the right values.However After the sort call, the list remains unchanged. Have I missed something obvious, or is there something else I need to do.EDIT: Yes I was being a fool, and the property returning a list was recreating it from scratch each time it was accessed

View 4 Replies

Sorting A List(Of FileInfo) By 2 Properties?

Oct 3, 2011

I have a List of FileInfo objects that I want to sort by creation date & file size. Is there a way to do that?

View 5 Replies

Sorting Items In A List View?

Aug 15, 2011

I am using the code from hereevelopment/vbnet/code/370426 to sort my listview items. But I want something more 'dynamic': when I click on a header column, I want that it changes the sorting based on the column that has been clicked. here is my code:

'Classes usadas
Imports System.Math
Imports System.IO

[code].....

View 3 Replies

Sorting List Of String Paths In .NET?

Aug 14, 2010

I would like to sort a list of strings which represent paths. The sort result will do have a hierarchical order. What I mean is: for each directory path, I want to list all files in that path (alphabeticaly or not doesn't matter) in first time. Then, each subdirectory path will be listed. For each subdirectory, I want all files..

[Code]...

View 2 Replies

Vb.net - Sorting A List Of <Object> With VB And LINQ

Mar 1, 2012

I'm trying out some LINQ expressions and can't get them to work with the List class. Basically I want to be able to sort a list of custom objects by property type, however the C# LINQ syntax is KILLING me and I can't figure out how to convert it to VB

Class Foo
Sub New(Name As String, Position As Integer)
Me.Name = Name

[code]....

View 2 Replies

VS 2008 Double Sorting Of A List?

Jan 19, 2010

I have been learning how to sort a list using lambda functions

excessPop.Sort(Function(f1, f2) f1.ID.CompareTo(f2.ID))

I am however struggling to sort a list using 2 parameters within a lambda function. The properties within my list that i need to sort by are Category and then by Cost. how to do this?

View 5 Replies

[2008] Sorting A List Within A Form By Name?

Feb 7, 2009

One displays a list of contributors for a charity and the amount given in a text box.However iv created another button but i need this to sort the list of names to just display the names and in alphabetical order.

[Code]...

View 19 Replies

Sorting Generic List On Multiple Keys?

Nov 2, 2009

I need to sort a list (of person) to person.Age within person.Department. f I user personlist.sort with a comparer for Age and then sort again with a comparer for Department, the sequence of age is destroyed.

View 1 Replies

Sorting Number Numerically In List View?

Dec 18, 2010

In 2007 I created a program that reads weather data into a listview. When a user clicks on the column header it fires off the column click event handler which calls the Sort Wrapper function. The Sort wrapper will re-order items either in ascending or descending order.

I have never been able to get negative integers to sort properly. I have created a stripped down listview program with a few numbers in the grid for testing. (see attached program zip file).When you run the program, click on the column header that says "Val" and you will see right away that the numbers do not sort correctly.

View 6 Replies

Sorting System.Collections.Generic.List?

Feb 2, 2012

I have a lists of different custom classes and each must be sorted severals times before the algorithm is complete. For each sort I wrote a comparer. Sofar so good. Everything works. But: By now I have abou a dozen different comparers in more than one class and it is still getting more. I wonder if there is a way to limit the number by writing a new general function that can be used to sort all lists without the need for a specific comparer.Below is what I've got so far. But it does not work.

"System.Collections.Generic.List(Of ClassA)" can not be converted into "System.Collections.Generic.List(Of Object)."

[code].....

View 2 Replies

Sorting Thousands Of Records - Linked List?

May 6, 2009

I'm looking for a simple and efficient way to sort up to 60,000 strings that are 3000 chars long in reverse order and save them back out to a text file.

I originally thought of a doubly linked list, but then I realized that we aren't privileged enough to have pointers.

Is there some other way I can create an efficient linked list without pointers?

View 7 Replies

VS 2008 Extracting Best Laptime And Sorting A List

Aug 22, 2011

So I'm working on this school project where I'm supposed to add names and laptimes from textboxes to a list. I've got that sorted out with some help from Shaggy_Hiker (thanks!). Now what I'm trying to do is get the best laptime from the list of entries and display that in a label. I also want to sort the list by laptimes in ascending order, and I've tried the.Sort method without too much luck + all entries with a laptime over 60 min should be disqualified.

(I'm thinking of adding all of these to a seperate list which I've named feilreg, but right now all entries that doesn't meet the right criteria like empty textbox, negative laptime and so on gets saved to that list. I'd like to make it just entries over 60 min) I also can't seem to figure out why a laptime of say '32.45' won't register, it has to be with a comma like '32,45'. I've got a function in my class 'Rundetid' to format the output to two decimals maximum.

[Code]...

View 6 Replies

VS 2008 Sorting A List(of Class) Using LINQ?

Apr 30, 2010

I'm using the following code to sort a List(of Class) using LINQ. It works fine, but I'm wondering if there is a better way to do it. I'm basically taking one list, applying LINQ to it, then using the result to create a second list in the sorted order. Can I do this without creating a second list? Here is my sample

' KeyMatch is my Class Variable
' mMatchList is the Unsorted List
'

[code].....

View 3 Replies

Sorting A List Based On An ArrayList Within A Custom Object

May 24, 2010

I am using a list to keep track of a number of custom Row objects as follows:

Public Rows As List(Of Row)()
Row has 2 properties, Key (a String) and Cells (an ArrayList).

I need to be able to sort each Row within Rows based on a developer defined index of the Cells ArrayList.

So for example based on the following Rows

Row1.Cells = ("b", "12")
Row2.Cells = ("a", "23")

Rows.Sort(0) would result in Row2 being first in the Rows list. What would be the best way of going about implementing this?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved