Hi Dianna,
I'm wondering if it might be easier to just sort the table and just write
an old fashion control >break. It might be more elegant.
I got this idea from your sentence, it is quick made, but I think that it is
generic usable.
I hope this helps a little bit?
Cor
\\\
Me.DataGrid1.DataSource = mydistinct.distinct(dt, "elem1")
///
\\\
Public Class Selectclass
Public Function distinct(ByVal dt As DataTable, _
ByVal dist As String) As DataTable
Dim dtclone As DataTable = dt.Clone
Dim dv As New DataView(dt)
dv.Sort = dist
Dim myselold As String = ""
For i As Integer = 0 To dv.Count - 1
If myselold <> dv(i)(dist).ToString Then
Dim drn As DataRow = dtclone.NewRow
For y As Integer = 0 To dv.Count - 1
drn(y) = dv(i)(y)
Next
myselold = dv(i)(dist).ToString
dtclone.Rows.Add(drn)
End If
Next
Return dtclone
End Function
End Class
///