Private Sub txtSearch_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtSearch.KeyPress

 

        If Asc(e.KeyChar) = Keys.Enter Then

 

            lstDescriptions.Items.Clear() 'empty the listbox

 

            Dim TheCollectionOfDescriptions As XmlNodeList

            Dim SingleCoinEntry As XmlNode

 

            Dim s As String

            Dim found As Boolean

 

            TheCollectionOfDescriptions = doc.GetElementsByTagName("singlecoinentry")

 

            For Each SingleCoinEntry In TheCollectionOfDescriptions

 

                s = SingleCoinEntry.InnerText

 

                If InStr(LCase(s), LCase(txtSearch.Text)) Then

                    lstDescriptions.Items.Add(SingleCoinEntry.FirstChild.InnerText)

                    found = True

                End If

 

            Next

 

            If found = True Then

                lstDescriptions.SelectedIndex = 0

                Call lstDescriptions_Click(Me, e)

                lstDescriptions.BackColor = Color.Beige

            Else

                btnShowAllTitles_Click(Me, e)

                MsgBox("Nothing matched your search term: " & txtSearch.Text)

            End If

 

        End If

 

    End Sub