I have a textbox for searching in my access database. For example, my database is dbEmpLis; my table name is tblEmployee; columns in my tblEmployee are fName, lName and mName. What I want to do is,when a user type to the search box, and click the search button, it will search to the database.Then if it find any match within the database it will return the value/s to the listbox.

Recommended Answers

All 2 Replies

I'm curious which are you wanting to fill ListView or ListBox? You're title say one and your question says another.



Declare a new DataSet, then execute a standard query to populate the DataSet.

Dim sqlString As String = ("SELECT tblEmployee.fName, tblEmployee.lName, tblEmployee.mName FROM tblEmployee WHERE tblEmployee.fName LIKE '%" & txtSearch.Text & "%'")

txtSearch.Text is an textbox on the form.

Go into a "for each" loop and place it into a list/grid-view.

Hope this helps.

Try reading up on queries if your going to be working with databases..


This would be an excellent place to start.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.