Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27285

vb.net go through all items in listbox and select closest matches

$
0
0
I have one button find,2 textboxes and one listbox.
I need code which would go through all items in listbox and select only closest matches and add them to another multiple textbox2 as you type in textbox1.

It find text as you type in textbox1 correctly but then i click the button find it can't find all sentence only one word like "live" not like "i live ok".

i have only this code for so far.

Code:

Dim s As String = Me.TextBox1.Text
        Dim lb As ListBox = Me.ListBox1
        lb.SelectedIndex = -1
        If s.Length > 0 Then
            For i As Integer = 0 To lb.Items.Count - 1
                If lb.Items(i).ToString.Contains(s) Then
                    lb.SelectedIndices.Add(i)
                End If
            Next
        End If

what a code is doing so it's trying to find exact words/strings in listbox using textbox and highlight them if they found in listbox.
But there is the problem with this code is that one can't search and find all words like these "i live ok" without the quotes.

It can find only entered text in textbox like this "live"
It can't find them i live ok it finds only one word not all sentence.

I need code that which can search through all items in listbox and select all words like "i live ok" not like so "live".
to understand it better how is working i have some examples.

Name:  1.png
Views: 25
Size:  27.3 KB

Name:  2.png
Views: 18
Size:  37.0 KB
Attached Images
  

Viewing all articles
Browse latest Browse all 27285

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>