i have a listview with columns:
I want to search the listview using "Date" in DateAndTime Column.ID, Contact_Name, Contact_Number, DateAndTime, Messages
using textbox_textChanged
the format of date in textbox6 = M/d/yyyyCode:Try Dim sqlQuery As String = "SELECT From SentItems WHERE DateAndTime like '%" & TextBox6.Text & "%'" Dim sqlCommand As New OleDbCommand Dim sqlAdapter As New OleDbDataAdapter Dim Table As New DataTable With sqlCommand .CommandText = sqlQuery .Connection = cn End With With sqlAdapter .SelectCommand = sqlCommand .Fill(Table) End With lvSent.Items.Clear() For i = 0 To Table.Rows.Count - 1 With lvSent .Items.Add(Table.Rows(i)("ID")) With .Items(.Items.Count - 1).SubItems .Add(Table.Rows(i)("Contact_Name")) .Add(Table.Rows(i)("Contacts_Number")) .Add(Table.Rows(i)("DateAndTime")) .Add(Table.Rows(i)("SentMessage")) .Add(Table.Rows(i)("Status")) End With End With Next Catch ex As Exception End Try
the format of date in listview = M/d/yyyy
the problem is every time I searched and the result found(matched). All items in listview appear also even it do not match the text in textbox. please help guys... thanks....




Reply With Quote
