- Private Sub mnusearch_Click()
- Dim search As String
- search = InputBox("Enter Name to Search for", "Search")
- Dim x As Integer
- Dim done As Integer
- Dim out As String
- Dim list1pos As Integer
- Dim list2pos As Integer
- Dim list3pos As Integer
- For x = 0 To lstLosAngeles.ListCount - 1
- If lstLosAngeles.List(x) = search Then
- list1pos = x + 1
- 'MsgBox search + " was found in " + Label2.Caption + "(Name #" + Str(x + 1) + ")"
- done = 1
- End If
- Next x
- For x = 0 To lstNewYork.ListCount - 1
- If lstNewYork.List(x) = search Then
- list2pos = x + 1
- 'MsgBox search + " was found in " + Label3.Caption + "(Name #" + Str(x + 1) + ")"
- done = 1
- End If
- Next x
- For x = 0 To lstOrlando.ListCount - 1
- If lstOrlando.List(x) = search Then
- list3pos = x + 1
- 'MsgBox search + " was found in " + Label6.Caption + "(Name #" + Str(x + 1) + ")"
- done = 1
- End If
- Next x
- If done = 0 Then
- MsgBox "This item was not found"
- Exit Sub
- End If
- If list1pos > 0 And list2pos > 0 And list3pos > 0 Then
- MsgBox search + " was found in: " + vbNewLine + Label2.Caption + "(Name #" + Str(list1pos) + ")" _
- + vbNewLine + Label3.Caption + "(Name #" + Str(list2pos) + ")" _
- + vbNewLine + Label6.Caption + "(Name #" + Str(list3pos) + ")"
- done = 2
- End If
- If list1pos > 0 And list2pos > 0 And done <> 2 Then
- MsgBox search + " was found in: " + vbNewLine + Label2.Caption + "(Name #" + Str(list1pos) + ")" _
- + vbNewLine + Label3.Caption + "(Name #" + Str(list2pos) + ")"
- done = 2
- End If
- If list2pos > 0 And list3pos > 0 And done <> 2 Then
- MsgBox search + " was found in: " + vbNewLine + Label3.Caption + "(Name #" + Str(list2pos) + ")" _
- + vbNewLine + Label6.Caption + "(Name #" + Str(list3pos) + ")"
- done = 2
- End If
- If list1pos > 0 And list3pos > 0 And done <> 2 Then
- MsgBox search + " was found in: " + vbNewLine + Label2.Caption + "(Name #" + Str(list1pos) + ")" _
- + vbNewLine + Label6.Caption + "(Name #" + Str(list3pos) + ")"
- done = 2
- End If
- If done <> 2 Then
- If list1pos > 0 Then
- MsgBox search + " was found in " + Label2.Caption + "(Name #" + Str(x + 1) + ")"
- ElseIf list2pos > 0 Then
- MsgBox search + " was found in " + Label3.Caption + "(Name #" + Str(x + 1) + ")"
- ElseIf list3pos > 0 Then
- MsgBox search + " was found in " + Label6.Caption + "(Name #" + Str(x + 1) + ")"
- End If
- End If
- done = 0
- search = ""
- End Sub