Click here to Skip to main content
15,843,865 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i wrote following code for split words in the list box(relatedWords)

string[] array = new string[relatedWords.Items.Count];
        for (int i = 0; i < relatedWords.Items.Count; i++)
        {
            object s = relatedWords.Items[i];
            array[i] = s.ToString();

            string synSet = array[i];
            string[] words = synSet.Split(',');

            foreach (string item in words)
            {


            }
        }


then i have following data List<> which attached to data grid view. that data grid is having column called Bodycontent
List<unreademails> list = (List<unreademails>)dgvUnreadMails.DataSource;  </unreademails></unreademails>



i need to search the words in the string[] words array in bodycontent . if at least only one word in array is found in list<> i need to update the data grid

pls help
Posted
Comments
OriginalGriff 16-Jul-10 14:24pm    
So what's the problem? You haven't asked any question!
Kasunmit 16-Jul-10 22:01pm    
i need to search the words in the string[] words array in bodycontent . if at least only one word in array is found in list<> i need to update the data grid

1 solution

You could try constucting a generic list of words and then using the contains method in the databound context.

C#
List<string> words = new List<string>();
foreach(ListItem li in relatedWords.Items)
{
    words.AddRange(li.ToString().Split(new char[]{','}, StringSplitOptions.RemoveEmptyEntries));
}

// and in databound context
words.Contains("word");
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900