Now I am having troubles deleting duplicate lines for some reason.

I got this code for erasing duplicate lines, but it isn't working when I try modifying it for this application:

vb.net Code:
  1. Dim Lines As New ArrayList
  2.         'put all the lines of the textfile into the arraylist
  3.         Lines.AddRange(IO.File.ReadAllLines("C:\dns.txt"))
  4.         'loop the arraylist in reverse because the IndexOf searches top to bottom
  5.         For i As Integer = Lines.Count - 1 To 0 Step -1
  6.             'if the return index is smaller than the index of the line we are
  7.             'searching for then we can remove that line because there is a duplicate
  8.             If Lines.IndexOf(Lines(i)) < i Then
  9.                 Lines.RemoveAt(i)
  10.             End If
  11.         Next