Index of a value in Datatable

We can do with LINQ:

(From d In dtData.AsEnumerable
Group d By k= d("Posting Key").toString.Trim Into grp=Group
From t In grp.Select(Function (x,i) Tuple.Create(i,x))
Let ra = New Object(){t.Item1 + 1, t.Item2("Posting Key")}
Order By dtData.Rows.IndexOf(t.Item2)
Select dtReport.Rows.Add(ra)).CopyToDataTable

or on a hybrid approach:

find starter help here:
GroupBy_1Col_MemberCount_OrderByOrigPos.xaml (14.4 KB)

Also have a look here:

1 Like