Hi there,
This is something to get you started on if you wanted to trim out multiple words.
Hopefully this will give you something to start with.
UPDATED WITH VB
Public Sub GetListItems(ByVal p_textToSearch As String)
Dim items As New ListBox.ObjectCollection(listBox1)
If (p_textToSearch.Contains("<")) AndAlso (p_textToSearch.Contains(">")) Then
Dim wordsStrings As String() = p_textToSearch.Split(">"c)
For Each wordsString As String In wordsStrings
Dim firstIndexOfBracket As Integer = wordsString.IndexOf("<", StringComparison.Ordinal)
If firstIndexOfBracket < 0 Then
firstIndexOfBracket = 0
End If
Dim preTrim As String = wordsString.Substring(firstIndexOfBracket)
Dim altered As String = preTrim.Replace("<", "")
items.Add(altered.Trim())
Next
End If
listBox1.Refresh()
End Sub
public void GetListItems(string p_textToSearch)
{
ListBox.ObjectCollection items = new ListBox.ObjectCollection(listBox1);
if ((p_textToSearch.Contains("<")) && (p_textToSearch.Contains(">")))
{
string[] wordsStrings = p_textToSearch.Split('>');
foreach (var wordsString in wordsStrings)
{
int firstIndexOfBracket = wordsString.IndexOf("<", StringComparison.Ordinal);
if (firstIndexOfBracket < 0)
{
firstIndexOfBracket = 0;
}
string preTrim = wordsString.Substring(firstIndexOfBracket);
string altered = preTrim.Replace("<", "");
items.Add(altered.Trim());
}
}
listBox1.Refresh();
}