Hi there everyone! I am working on removing items from a listbox that end in a specific number.
I use this code from an earlier project to search for items with the letter B and remove them from list1
I would like to do the same thing, but the issue now, is instead of removing items with a B, I would like to remove whatever is the last digit in a textbox called Searchtxt.text
For example, if I entered the number 23 in the textbox, I would like to search for any number in the list1 that has a 3 at the end of it. I don't think Mid$ would work for this though, because sometimes the number entered would be 1 digit, in which case it would just search for that anyway, or a 3 digit number, but regardless of how many digits are entered, it only looks for matches for numbers with the same last digit and removes them.
Would Mid$ work for that?
Thanks!
I use this code from an earlier project to search for items with the letter B and remove them from list1
VB Code:
Dim i As Long For i = List1.ListCount - 1 To 0 Step -1 If Mid$(List1.List(i), 1, 1) = "B" Then List1.RemoveItem i End If Next
I would like to do the same thing, but the issue now, is instead of removing items with a B, I would like to remove whatever is the last digit in a textbox called Searchtxt.text
For example, if I entered the number 23 in the textbox, I would like to search for any number in the list1 that has a 3 at the end of it. I don't think Mid$ would work for this though, because sometimes the number entered would be 1 digit, in which case it would just search for that anyway, or a 3 digit number, but regardless of how many digits are entered, it only looks for matches for numbers with the same last digit and removes them.
Would Mid$ work for that?
Thanks!