I am really new at this...
I can not replace an item inside of a listbox with another item. It ony ends up going to the bottom. I'm sure it's probably pretty easy so any help would be great. Thanks
Printable View
I am really new at this...
I can not replace an item inside of a listbox with another item. It ony ends up going to the bottom. I'm sure it's probably pretty easy so any help would be great. Thanks
GoTo http://www.freevbcode.com/ShowCode.Asp?ID=313. This is a function that allows you to find a string in a list box or combo box. Paste the code into your project. Then, use the function (called FindStringinListControl) as follows:
Dim lIndex as Long
lIndex = FindStringinListControl(List1, "SearchText")
If lIndex <> -1 then
List1.RemoveItem lIndex
List1.AddItem "Replacement Text", lIndex
End If
I forgot to mention that I wouldn't know what to search for as this is user submitted text.. I need to know how to replace it using a line number..
Just say
Listbox.List(i) = "new string", where i is the 0-based (line)item no of the list box item. Wont this help?
RK