Get index of a row

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

Guest

I want to be able to take an Integer value that references a primary key.
Find the corresponding row and then get the index of that row.

Dim n As integer = 5 '(hypothetically)
Dim row1 As System.Data.DataRow = Me.DataSet11.Main.Row.Find(n)

How do I get the index of that row that I just found?
I obviously thought of IndexOf() but it doesn't work by doing row1.IndexOf()
 
bh,

AFAIK you cannot, you can find a row however not its index in a
datatable.datarowcollection.

(You can find it by looping through the collection, however that is
probably not what you are asking for)

It does not help you much however prevent you maybe from searching to long.

Cor
 

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