filter datatable using indices

S

Sam

Hi,

I have filtered a datatable using a dataview. Afterward, I get the
datarow indices of the datable of the rows that are contained by the
dataview:

Dim MyIndex As New ArrayList

For Each drv As DataRowView In myDataview
MyIndex.Add(myDatatable.Rows.IndexOf(drv.Row))
Next

I hope it's clear enough :)
Now what I would like to do is to filter again the datatable using
another dataview, but this time the filter would be the indices
contained in myIndex. Is it possible ? If not, how can I do that ?

Thanks
 
S

Sam

arf... I've found out by myself :

dt2 = myDatatable.Clone
For Each index As Integer In MyIndex
dt2.ImportRow(myDatatable.Rows(index))
Next

Dim dv2 As DataView = New DataView(dt2)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top