Click here to Skip to main content
15,896,359 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
Hi i have a two text box one is multi line text box as "txtshowfile" and another text box is "txtsearch". Suppose In txtshowfile there are 10 sentences written in line by line now i wrote a word in txtsearch box and click a button event event so i want in
txtshow file if the word is found then specific word is highlighted and if in a line one or more words are found then all are highlighted.
Please help me out.

Thanks in Advance.
Posted
Updated 28-Jan-12 1:41am
v2
Comments
BillWoodruff 28-Jan-12 10:55am    
Appears to be an exact duplicate of a question asked yesterday by "soothingshruti:" http://www.codeproject.com/Answers/320694/how-to-find-a-specif-word-in-a-richtext-box-libe-b#answer2

You both in the same class ? :)

If you take any editor as like FCKD editor then u can get that kind of feature/
or if u want to highligh on the Lebel text then also possible

..i dont know text box has such kind of feature
 
Share this answer
 
Comments
mayankshrivastava 27-Jan-12 4:34am    
it is possible from rich text box ?
C#
string search = txtsearchgerman.Text;
                if (i > 0)
                {
                    gerendindex = gerendindex + rtbgermanfile.Lines[k].Length + 1;
                }
                while (m != -1)
                {
                    m = rtbgermanfile.Lines[i].IndexOf(search, m);
                    if (m != -1)
                    {
                        if (i == 0)
                        {
                            rtbgermanfile.SelectionStart = m;
                            rtbgermanfile.SelectionLength = search.Length;
                            rtbgermanfile.SelectionColor = Color.Red;
                            m = m + search.Length;
                            flag1++;
                        }
                        else
                        {
                            rtbgermanfile.SelectionStart = m + gerendindex;
                            rtbgermanfile.SelectionLength = search.Length;
                            rtbgermanfile.SelectionColor = Color.Red;
                            m = m + search.Length;
                            flag1++;
                        }
                    }
                }
 
Share this answer
 

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