Click here to Skip to main content
16,017,857 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,I have two text boxes.In first text box suppose i write a sentence "My name is Mayank" now i want a word mayank from first text box so i write mayank in second text box than click to Find button.
i used that code but namespace doesn't work
//namespace DisplayWordJaNein


and code is-
C#
string txtfilesentence;
            string word;
            txtfilesentence = txtshowfile.Text;
            word = txtwordmatch.Text;

            if (string.Equals(txtfilesentence, word))
            {
                lblfound.Text = "word matched";
            }
            else
            {
                lblnotfound.Text = "word not matched";
            }

or how to use another namespace ?
Posted
Updated 4-Jan-12 2:08am
v3

Change your code to this .. It will work

C#
string txtfilesentence=string.Empty;
        string word=string.Empty;
        txtfilesentence = txtshowfile.Text.Trim();
        word = txtwordmatch.Text.Trim();
        if (txtfilesentence.Contains(word))
        {
            lblfound.Text = "word matched";
        }
        else
        {
            lblnotfound.Text = "word not matched";
        }


Edited
 
Share this answer
 
v3
VB
function findit(byRef TheText) as integer
dim i as integer
i=instr(RichTextBox1.text, TheText)
return i
end function
 
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