Subject: Re: Getting RowIndex from a DataTable
Date: Mon, 23 Aug 2004 15:58:00 +0200
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Message-ID: <
[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: bzq-165-146.dsl.bezeqint.net 62.219.165.146
Path: cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:59835
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
This method isn't very efficient, its like performing the search twice on
the table, and the first one is therefore unnecessary.
But it seems theres no other way...
----- Original Message -----
From: "Jon Skeet" <
[email protected]>
To: "Tomer" <
[email protected]>
Sent: Monday, August 23, 2004 2:40 PM
Subject: RE: Getting RowIndex from a DataTable
This only retrieves a Datarow and does not give me a row
index. I need the row index so that I can use it on a
datagrid linked to the table, so that it will show me the
right record. Same thing with a combobox.
Ah, right.
Well, ComboBox.Items has IndexOf which takes the object that you've
previously found.
Not sure why there isn't an equivalent for DataTable - I suggest just
using Find to get the DataRow, and then using something like:
for (int i=0; i < dataTable.Rows.Count; i++)
{
if (dataTable.Rows
== foundRow)
{
...
}
}
Jon