Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i am using VB 2010.my project have two listbox ,textbox and access 2007 database. database and 1st list box databind it’s work. when i type textbox any word,1st listbox filter it’s work.but those filter item need to show 2nd listbox
Posted
Comments
DamithSL 1-Jul-14 13:41pm    
can you explain with your code? how you filter items when you type in textbox?
praveenlob7 2-Jul-14 5:46am    
Could you paste the code here?
Member 10350022 3-Jul-14 12:09pm    
this is my code

Public Class Form1

Dim tblcontactconnection As New OleDb.OleDbConnection
Dim provider As String
Dim dbtblcontact As String
Dim dstblcontact As New DataSet
Dim datblcontact As OleDb.OleDbDataAdapter
Dim SqlQuery As String
Dim NumberofRows As Integer
Dim NumberRow As Integer = 0
Dim dt As DataTable


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
provider = "Provider=Microsoft.Ace.Oledb.12.0;"
dbtblcontact = "Data Source =..\data\Addressbook.accdb "
tblcontactconnection.ConnectionString = provider & dbtblcontact
tblcontactconnection.Open()
SqlQuery = "SELECT * FROM tblcontact"
datblcontact = New OleDb.OleDbDataAdapter(SqlQuery, tblcontactconnection) '
datblcontact.Fill(dstblcontact, "tblcontact")
tblcontactconnection.Close()
Me.BindingSource1.DataSource = dstblcontact.Tables("tblcontact")
Me.ListBox1.DisplayMember = "name"
Me.ListBox1.DataSource = Me.BindingSource1

End Sub


Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

'ListBox2.Visible = TextBox1.Text <> ""
ListBox2.Items.Clear()
Me.BindingSource1.Filter = "name LIKE '%" & TextBox1.Text & "%'"

End Sub
End Class

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