select a specific row in datagrid

nikki

Member
Joined
Sep 7, 2006
Messages
21
Programming Experience
Beginner
I am doing on windows application.database is MS access.

I created one textbox named txtcustname.i put one datagrid.i want to select particular rowwhen i enter the customername in that textbox,it will search the entire grid and select that row if its there. if its not there will show the record is not found msg.


any help?
 
datagrid dont hold data. they show data that is held in datatables. ensure that there is a bindingsource in between your datagrid and the data table. the grid gets its data from the bindingsource, the source gets its data from the table

The bindingsource has a FILTER method that takes a string similar to a where clause in SQL

i.e. upon text change, you would issue this FILTER clause:

myBindingSource.Filter = "LastName = '" & textBox1.Text & "'"


You can determine if the Filter matched any rows using the
myBindingSource.List.Count property. If it is 0, then the list contains no results.

Hopefullythis will enable you to continue. If you have further difficulty, feel free to ask
 
Back
Top