I’m comparing richTextBox1 and richTextBox2 word by word.
// collect words from ritchtextbox1
String[] test = richtextbox1.text.Split(" ", StringSplitOptions.RemoveEmptyEntries);
// find each word test to richtextbox2
// if it is found then change back color of particular word to green of the
// else change back color of particular word to red in richtextbox1
test = richtextbox2.text.Split(" ", StringSplitOptions.RemoveEmptyEntries);
// find each word in test to richtextbox1
// if it is found then change back color of particular word to green of the
// else change back color of particular word to red in richtextbox2
can any one help me in code i’m little bit poor in syntax.
im taking reference of mateusz code
String[] test = richtextbox1.text.Split(" ", StringSplitOptions.RemoveEmptyEntries);
String[] test2 = richtextbox2.text.Split(" ", StringSplitOptions.RemoveEmptyEntries);
bool wordNotFound=false;
for (int i=0;i<test.lenght;i++)
for (int j=0;j<test2.length;j++){
if (test[i].equals(test2[j])){
wordNotFound=true
break;
}
else wordNotFound=true;
}
//// here i need the to change particular word back color not entire ritchtextbox
if (wordNotFound) richTextBox1.BackColor = Color.Red;
else richTextBox1.BackColor = Color.Green;
im not comparing two text boxes im validating each word which is exist in both side or not. just like spell check taking dictionary as one richtextbox1. spell check [valid word] in richtextbox2. vice versa…
If you are only interested in whether all words are valid or not, you can simple check it by
PS: Of course,
new string[]{}s should be replaced withrtb.Split(....)*