ListView in VB.Net

khwo's Avatar
Light Poster
Hi all,

I am using the following code for my searching function, but when I try to run it, it are allow me to search the item for column 1, but I want to search the item for column 2 as well columun 3, what mistake I have make, can anyone give me some advice on this?

This is my code:
Code: VB
Private Sub ListView_Master_ColumnClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ColumnClickEventArgs) Handles ListView_Master.ColumnClick

    Dim exactMatch As Boolean
    Dim mySearchText As String

    Select Case e.Column
        Case 0 'column one BOM ID
            'Search for item at column 0 when user click on column 0
            'MsgBox(e.Column)

        Case 1 'column two Cust Part # = BOM
            'Search for item at column 1 when user click on column 1

            MsgBox(e.Column)

            mySearchText = Trim(InputBox("Please enter your Customer Part #", "Search Product Master Entry Data"))

            For Each itm As ListViewItem In ListView_Master.Items
                If exactMatch Then
                    If itm.Text = mySearchText Then
                        ' an exact match was found ...
                        MsgBox("Exact")
                    End If
                Else
                    mySearchText &= "*"
                    If itm.Text Like mySearchText Then
                        ' a partial match was found ...
                        MsgBox("Partial")
                    End If
                End If
            Next

        Case 2 'column three Child Part#A = CodeAChild Part#B = CodeB
            'Search for item at column 2 when user click on column 2
            MsgBox(e.Column)

        Case 3 'column three Child Part#B = CodeB
            'Search for item at column 3 when user click on column 3

            MsgBox(e.Column)

    End Select

End Sub

Last edited by shabbir; 14Jul2006 at 10:36.. Reason: Code block
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
From Before you make a query.
Quote:
7) Use code tags. Use the appropriate code tag (e.g. [ php][/php ] and [ code][/code ]) to make your code easier to read. See BB Code Section for [Code]
You dont have any searching code for case '2' and case '3'