I have a CSV file I want to manipulate. I am dropping the csv into a list box, then going through line by line. I want to check a column for duplicates, and then:

---ex of the columns in csv file---
Column1-----Column2--------Column3
------------------------------------
004.tif----------9------------Keep
005.tif---------10
006.tif---------13
004.tif---------15------------Bad
007.tif---------17
004.tif---------25------------Bad

1.) if there is a duplicate (004.tif), go to the next column(2) and store the value in a field. Then if I come across another value which is a duplicate(4th line), check the other column and compare the 2 values, keeping the lowest, and flagging the higher one with a value in another column(3) so the result would look something like what you see above. I already have a function to put the csv into a list box:

VB Code:
  1. Private Function CSV2ListBox()
  2.  
  3.         'This function gets all data from the specified csv file,
  4.         'and places it in row by row in a listbox
  5.  
  6.         Dim filetoread As String
  7.         Dim filestream As StreamReader
  8.         Dim readcontents As String
  9.  
  10.         Dim s As String
  11.         Dim a() As String
  12.         Dim j As Integer
  13.  
  14.         filetoread = System.IO.Path.GetFullPath("C:\len\test.csv")
  15.         filestream = File.OpenText(filetoread)
  16.         readcontents = filestream.ReadToEnd()
  17.  
  18.         s = readcontents
  19.  
  20.         lstResult.Items.Clear()
  21.  
  22.         a = s.Split(vbLf)
  23.  
  24.         For j = 0 To a.GetUpperBound(0) - 1
  25.             lstResult.Items.Add(a(j))
  26.         Next
  27.  
  28.     End Function

Any help is greatly appreciated