954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

ListView in VB.Net

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:,
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

khwo
Newbie Poster
12 posts since Jun 2006
Reputation Points: 10
Solved Threads: 0
 

Dim Var1 as string = Me.ListView1.SelectedItems(0).SubItems(0).Text

...

Dim Var5 as string =Me.ListView1.SelectedItems(0).SubItems(4).Text

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You