Click here to Skip to main content
15,911,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I create one textbox the textbox as search.

already i create gridview and then added database.

my database name is student,

my gridview column name Such as

Name Id Address Course Etc.,

numbers of fields add in gridview.

i want search the specific name search in the textbox.

Please send related tutorials or links
Posted

Use Autocompletesource in textbox. Sample code:

VB
Dim dt As New DataTable
          Dim da As New OleDbDataAdapter("select * from Tablename", ocon)
          da.Fill(dt)
          Dim row As DataRow
          TextBox1.AutoCompleteCustomSource.Clear()
          For Each row In dt.Rows
              TextBox1.AutoCompleteCustomSource.Add(row.Item(0).ToString)
          Next
 
Share this answer
 
What part of this are you having trouble with specifically? You just need to loop through the rows of data and compare the name field to whatever is in your textbox. Once you've found a "match" you do whatever you want the search to do...which I'd assume would be to scroll to that row. As for what a "match" is, you'd have to explain further. If a user types "J" into the textbox, do you want all names that start with J? Or all names that contain a J? Or only names that are exactly J?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900