Iím using the following coding for my searching function at listview, but I facing some problem here, if I use this code I only able to search the item at column 0 for the listview. But for my case, I want to let user click on the header of the column then the user only can key in the data for that column they select, what mean is if user click on the column 0 at the header of the listview then user only can search what ever data appear at the column 0 for the listview. As well for column 1, column 2 for the listview. The following coding only allow me to search the data at column 0 even I use the select case for the column click. What mistake I have made? Can anyone give me some advice on this? Thanks.
This is my coding for the searching function at lisview:-
Private Sub ListView_Master_ColumnClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ColumnClickEventArgs) Handles ListView_Master.ColumnClick
Dim Search_Code As String
Dim exactMatch As Boolean
Dim mySearchText As String
Select Case e.Column
Case 0 'column one BOM ID
Case 1 'column two Cust Part # = BOM
mySearchText = Trim(InputBox("Please enter your Customer Part #", "Search Product Master Entry Data"))
'For Each itm As ListViewItem In ListView_Master.Items
For Each itm As ListViewItem In ListView_Master.Items
If exactMatch Then
If itm.Text = mySearchText Then
' an exact match was found ...
mySearchText &= "*"
If itm.Text Like mySearchText Then
' a partial match was found ...
Case 2 'column three Child Part#A = CodeAChild Part#B = CodeB
Case 3 'column three Child Part#B = CodeB