ListView in VB.Net

Discussion in 'Visual Basic ( VB )' started by khwo, Jul 14, 2006.

  1. khwo

    khwo New Member

    Joined:
    Jul 6, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    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:
     
    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 a moderator: Jul 14, 2006
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,335
    Likes Received:
    377
    Trophy Points:
    83

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice