Click here to Skip to main content
12,401,984 members (56,891 online)
Rate this:
Please Sign up or sign in to vote.
See more: (untagged)
Hello .

i want to find a word in the textbox

i want if the word was between two <> then , the result are displayed in a listbox


OP's additional information moved from non-solution below
Excuse me, i am work with
please help me , very necessary
Posted 12-Nov-12 3:18am
Updated 12-Nov-12 4:27am
richcb 12-Nov-12 9:42am
What language? What have you tried?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.


''' <summary>
 ''' Gets the list items.
 ''' </summary>
 ''' <param name="p_textToSearch">The text to search.</param>
 Public Sub GetListItems(ByVal p_textToSearch As String)
     'listBox1 is the listbox you want to populate
     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("<", "")
     End If
 End Sub

/// <summary>
/// Gets the list items.
/// </summary>
/// <param name="p_textToSearch">The text to search.</param>
public void GetListItems(string p_textToSearch)
    //listBox1 is the listbox you want to populate
    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("<", "");

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 13 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100