Does anyone have any sample code of how to do this? ex:
a
b
b
c
b
d
will end up as
a
b
c
b
d
Does anyone have any sample code of how to do this? ex:
a
b
b
c
b
d
will end up as
a
b
c
b
d
It looks to me like you want to remove repeating lines, and not simply get a list of distinct values (as demonstrated by the presence of the 'b' before the 'd' in the desired output).
If so, you can use code like this:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim lines As New List(Of String)(TextBox1.Lines)
For i As Integer = lines.Count - 1 To 1 Step -1
If lines(i) = lines(i - 1) Then
lines.RemoveAt(i)
End If
Next
TextBox1.Lines = lines.ToArray
End Sub