DataView IndexOf

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a CustomerTable which is a DataTable.
I have a PersonalDataView which is a DataView.

The code below returns the row index of the table beautifully.
Any pointers on how to get the row index of the DataView?

Thanks,
Randy


DataRow dr = CustomerTable.Rows.Find(CustomerId);

if(dr != null)
{
positionIndex = CustomerTable.Rows.IndexOf(dr);

//How do I modify the following line to get the IndexOf the
DataView
//int viewIndex =
((IList<DataView>)PersonalDataView).IndexOf(dr);
}
 
Hi Randy,

Thank you for posting.

You can use the following statement to get the index of a row from the
DataView.
positionIndex = PersonalDataView.Table.Rows.IndexOf(dr);

If you have any thing unclear, please don't hesitate to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

====================================================
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
====================================================
 

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

Back
Top