I have a two ListBoxes listbox1 and listbox2. I want to get all the duplicate items in ListBox1 that i'd search in a TextBox and put in into ListBox2 and when all the duplicate item's that i'd search is in ListBox2 its automatically count please help me.
For example, items in ListBox1
DOG
DOG
DOG
CAT
CAT
When I type DOG in TextBox all the DOG in ListBox1 will be copied to ListBox2. How can I do it?
I tried this
Dim check As Boolean
For Each item In ListBox1.Items
check = ListBox1.FindStringExact(item)
ListBox2.Items.Add(item)
Next
i also try this but its wrong it count's the line before the exact word that i'd search. for example DOG DOG DOG CAT CAT i'd search CAT in textbox the output in listbox2 is 3 here's my code :
Dim check As String
check = ListBox1.FindStringExact(TextBox1.Text)
ListBox2.Items.Add(check)