Search in datagrid and highligt row in a datagrid when found

I need to have a button that I click that brings up a text box to type in the # I need to find in the datagrid and then when I click search it highlights that row in the the datagrid.  My datagrid is tied to a dataset created in VS.net 2003. How can I do this please.

thanks
running32Asked:
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.

ElrondCTCommented:
How is your grid tied to the dataset? It's generally easiest to check the data in the underlying data structure rather than in the grid cells. So if you have a DataView as the grid's source, you could do something like this, where dvwData is the DataView bound to grid dgDisplay and strSearch is what you're searching for:

For I as Integer = 0 to dvwData.Count - 1
    If CStr(dvwData(I)("fldCheck")) = strSearch Then
        dgDisplay.Select(I)
        Exit For
    End If
Next I
0
running32Author Commented:
I have my datagrid tied to a dataset how can I chagne it.

billingcount = SqlDataAdapter4.Fill(DspaBilling1)
            DataGrid1.DataSource = DspaBilling1
            DataGrid1.DataMember = "tblPAVoucher"
            'frmloading.Hide()
            Dim tablestyle As New DataGridTableStyle
            tablestyle.MappingName = DspaBilling1.Tables(0).TableName
0
ElrondCTCommented:
Try something like:

For I as Integer = 0 to DspaBilling1.Count - 1
    If DspaBilling1(I).fldCheck = strSearch Then
        DataGrid1.Select(I)
        Exit For
    End If
Next I
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
running32Author Commented:
I get the error DspaBilling1(I).fldCheck  cannot be indexed because i has not default property.  Thanks
0
ElrondCTCommented:
"fldCheck" is just a placeholder. You'll have to put in the name of your actual field that you want to check against. Likewise, you need to replace "strSearch" with whatever value you want to look for. I don't know what those actual variable names are because you haven't posted that information.

However, I don't know why you'd get an error that it can't be indexed. Nothing in the code I provided has anything to do with indexing. Perhaps you should post your code (just the section where there's a problem), and flag which line is active when you get the error.
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.