473,387 Members | 1,517 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,387 software developers and data experts.

I have a DataRow, I need to get the RowIndex...

Using FindRows I can get the array of DataRows that match my search
criteria. However I want to find out what rows these represent in the
overall DataTable. FindRows acts like a filter, but in my case, the
rows that are near the found rows (before or after) are significant to
the search. For example, if I FindRows matching
'TransactionNumber=12345', I would also be interested in seeing the
transactions that occurred around the same time. I can't find a way to
get from the DataRow collection back to their location within the main
DataTable. It seems CurrencyManager should help, but again, it's going
backwards from the usual implementation. Any ideas?
Thanks,
Gary B
Nov 20 '05 #1
2 5434
Hi,

ds.Tables(0).DefaultView.Sort = "Column1"
Dim drFind() As DataRowView =
ds.Tables(0).DefaultView.FindRows("12")
Dim cm As CurrencyManager = CType(Me.BindingContext(ds.Tables(0)),
CurrencyManager)

For iRow As Integer = 0 To ds.Tables(0).Rows.Count - 1
If ds.Tables(0).Rows.Item(iRow).Equals(drFind(0).Row) Then
cm.Position = iRow
Exit For
End If
Next
Ken
-----------------------
"GaryB" <ga****@chartermi.net> wrote in message
news:fe**************************@posting.google.c om...
Using FindRows I can get the array of DataRows that match my search
criteria. However I want to find out what rows these represent in the
overall DataTable. FindRows acts like a filter, but in my case, the
rows that are near the found rows (before or after) are significant to
the search. For example, if I FindRows matching
'TransactionNumber=12345', I would also be interested in seeing the
transactions that occurred around the same time. I can't find a way to
get from the DataRow collection back to their location within the main
DataTable. It seems CurrencyManager should help, but again, it's going
backwards from the usual implementation. Any ideas?
Thanks,
Gary B

Nov 20 '05 #2

Much Thanks Ken, the

ds.Tables(0).Rows.Item(iRow).Equals(drFind(0).Row)

was the missing link for me. I didn't know (or think to find) that there
was a way to check if DataRows were equivalent.
Thanks again,
gary b

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #3

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

Similar topics

4
by: webdev | last post by:
Folks, Can someone please tell me why this simple piece of code, irritatingly, fails to give the expected result? Regards Rae MacLeman <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0...
11
by: Tim Frawley | last post by:
I need to return a DataRow or the Row Index in a DataSet wherein the value I am attempting to find is not a primary key. I have to do this often, more than 200 times when importing a file so it...
1
by: keithb | last post by:
I have a command button in GridView row that fires the RowCommand Event when clicked. The event handler looks like this: protected void grid_RowCommand(Object sender, GridViewCommandEventArgs e)...
13
by: David | last post by:
Hi all, I have a singleton ienumerable that collects data from a database. I have listed the code below. It has the usual methods of current, move and reset. I need to go to a certain position...
5
by: Rainer Queck | last post by:
Hello NG, what would be the best way to locate a DataRrow in a DataGridView? I have by DataTable.Select a bunch of DataRows from a DataTable (which is the data source to the DataGridView). Now...
2
by: =?Utf-8?B?TWFyYw==?= | last post by:
In Visual Studio 2005, I am developing a Windows Mobile application, using Mobile SQL 2005. I need Data from a Database to be shown in a DataGrid, this works. But now I want to be able to get the...
1
by: QuickBooksDev | last post by:
VB.NET 2005 DataGridView Checkbox - Check Event need to know check status I would like to use the DataGridView Checkbox like a normal checkbox. When someone clicks on it I would expect that I...
0
by: steve | last post by:
I have been fighting with trying to update a GridView for a while. I don't want to use the "built-in" way to do it because I am using business layer methods for updating and deleteing and I don't...
9
by: myotheraccount | last post by:
Hello, Is there a way to convert a DataRow to a StringArray, without looping through all of the items of the DataRow? Basically, I'm trying to get the results of a query and put them into a...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.