By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,398 Members | 1,362 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,398 IT Pros & Developers. It's quick & easy.

Get index of a row

P: n/a
bh
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()
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

"bh" <bh@discussions.microsoft.com>
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()

Nov 21 '05 #2

P: n/a
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

"bh" <bh@discussions.microsoft.com>
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()

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.