473,396 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Finding the row index in a collection of rows

So that I can find the pageindex in my datagrid, I need to know the index in
a collection of rows where based on a record id. Right now, I have to loop
through the entire collection.

Is there a better way. Thanks in advance.

I tried to figure out the find method, but it seems to be asking for an
object... dsAccounts.Tables(0).rows.find(???)

row_index = 0

For Each drow In dsAccounts.Tables(0).Rows

row_index = row_index + 1

If drow.Item("ID") = returned_id Then Exit For

Next
Jul 19 '05 #1
1 2399
Thats what I was looking for. Thanks!

"Prasad" <pr********@hotmail.com> wrote in message
news:Oh**************@TK2MSFTNGP09.phx.gbl...
Hi

Use

DataView dv = new DataView(dsAccounts,"","ID")
int RowIndex = dv.Find("1001")

HTH
Prasad
"Jim Mitchell" <ji**********@mindspring.com> wrote in message
news:Ow**************@TK2MSFTNGP09.phx.gbl...
So that I can find the pageindex in my datagrid, I need to know the
index in
a collection of rows where based on a record id. Right now, I have to

loop
through the entire collection.

Is there a better way. Thanks in advance.

I tried to figure out the find method, but it seems to be asking for an
object... dsAccounts.Tables(0).rows.find(???)

row_index = 0

For Each drow In dsAccounts.Tables(0).Rows

row_index = row_index + 1

If drow.Item("ID") = returned_id Then Exit For

Next


Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jim Mitchell | last post by:
So that I can find the pageindex in my datagrid, I need to know the index in a collection of rows where based on a record id. Right now, I have to loop through the entire collection. Is there a...
6
by: TB | last post by:
Hi All: Here´s a very simple question: I have created a datatable inside a dataset, and subsequently selected a particular row using certain criteria. How do get the index number of that...
14
by: Rich | last post by:
Yes, I need to store some values in an array type collection object that can hold 3 or more parameters per index. I have looked at the collection object, hashtable object and would prefer not to...
0
by: ssims | last post by:
I've got a GridView that's sorted by a stored procedure with ROW_NUMBER: PROCEDURE dbo.GetCalendarsByStatusIDPaged ( @startRowIndex int, @maximumRows int, @statusID int ) AS
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.