Find Rowindex of Datarow

Hello,
I am trying to find rowindex of datarow( vb.net desktop). The code is as follows:
 Dim dtDgDiarySource As New DataTable
                                            dtDgtestSource = FrmMain.Dgtest.DataSource
                                            Dim rows As DataRow()
                                            rows = dtDgtestSource.Select("D_UID  = '" & row.Item("D_UID").ToString() & "'")

Open in new window


Cheers
RIASAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
Do you mean which row is that you pull out from in the DataSource collection?
0
RIASAuthor Commented:
Yes, Andy :> Need the row index
0
RIASAuthor Commented:
Been struggling with this for quite sometime
0
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

AndyAinscowFreelance programmer / ConsultantCommented:
I'd suggest a Foreach loop with a counter.  Break out of the loop when you find the row you want - the counter would then be the index of that row.
0
RIASAuthor Commented:
Yes Andy thanks for that but was trying to find some clever way ..
0
AndyAinscowFreelance programmer / ConsultantCommented:
Or does this work?
dim rowindex as long = dtDgtestSource .Rows.IndexOf(rows)
0
RIASAuthor Commented:
Thanks will try and brb
0
AndyAinscowFreelance programmer / ConsultantCommented:
or maybe
dim rowindex as long = dtDgtestSource .Rows.IndexOf(rows[0])
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RIASAuthor Commented:
Thanks
0
RIASAuthor Commented:
Perfect!!!!!Thanks mate as always!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.