Thanks, you code is quite nice
"Cor Ligthert" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Oka,
>
> I was thinking that that was the problem, however was not sure in the way
> you did describe it.
>
> There is not a distinct as a class in dotNet.
>
> You can try this sample I once made as a generic class for it.
>
> This is VB, when you need it in C# use it as a template, there are no
> special VB functions in it only the standard dotNet subset.
>
> I hope this helps?
>
> Cor
> \\\\
> ' somewhere in your program
> e.DataGrid1.DataSource = mydistinct.distinct(dt, "elem1")
> End Sub
> End Class
> \\\
> 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
> ///
>
>