T
Twinkle
HI guy
I am using This Code For Compare Two Files at Button Click
Event. if user select Data from richtextbox1 and click the Compare
Button then it will match with second richtextbox2 data. this code is
working but not according to my requirement. my requirement is if user
select data from richtextbox1 and click the button then it should be
match with richtextbox2 and if there is no matching then highlight that
word or line by color change.
plz help me i gave up myself
string[,] line = new string[500, 2];
string[,] line1 = new string[500, 2];
char[] fullstop = new char[2];
int i=0;
for (i = 0; i < 500; i++)
{
line[i,1] = "0";
line1[i,1]= "0";
}
fullstop[0] = '.';
fullstop[1] = '?';
string error=" ";
string[] AllLine = new string[500];
AllLine = richTextBox1.SelectedText.Split(fullstop);
string[] AllLine1 = new string[500];
AllLine1 = richTextBox2.SelectedText.Split(fullstop);
i = 0;
while (AllLine != "" && AllLine1 != "")
{
line[i, 0] = AllLine;
line1[i, 0] = AllLine1;
string[] word = new string[50];
string[] word1 = new string[50];
int j=0;
for (j = 0; j < 50; j++)
{
word[j] = null;
word1[j] = null;
}
fullstop[0] = ' ';
word = line[i, 0].Split(fullstop);
word1 = line1[i, 0].Split(fullstop);
int len,len1,min;
len1 = word1.Length;
len = word.Length;
if (word.Length > word1.Length)
min=word1.Length;
else
min=word.Length;
j = 0;
while (j < min)
{
if (word[j] != null && word1[j] != null)
{
if (word[j] != word1[j])
{
error = error + " " + word1[j];
}
}
j++;
}
if (word1.Length > word.Length)
{
for (; j < word1.Length; j++)
error = error + " " + word1[j];// prints blah
}
i++;
}
richTextBox3.Text = error;
I am using This Code For Compare Two Files at Button Click
Event. if user select Data from richtextbox1 and click the Compare
Button then it will match with second richtextbox2 data. this code is
working but not according to my requirement. my requirement is if user
select data from richtextbox1 and click the button then it should be
match with richtextbox2 and if there is no matching then highlight that
word or line by color change.
plz help me i gave up myself
string[,] line = new string[500, 2];
string[,] line1 = new string[500, 2];
char[] fullstop = new char[2];
int i=0;
for (i = 0; i < 500; i++)
{
line[i,1] = "0";
line1[i,1]= "0";
}
fullstop[0] = '.';
fullstop[1] = '?';
string error=" ";
string[] AllLine = new string[500];
AllLine = richTextBox1.SelectedText.Split(fullstop);
string[] AllLine1 = new string[500];
AllLine1 = richTextBox2.SelectedText.Split(fullstop);
i = 0;
while (AllLine != "" && AllLine1 != "")
{
line[i, 0] = AllLine;
line1[i, 0] = AllLine1;
string[] word = new string[50];
string[] word1 = new string[50];
int j=0;
for (j = 0; j < 50; j++)
{
word[j] = null;
word1[j] = null;
}
fullstop[0] = ' ';
word = line[i, 0].Split(fullstop);
word1 = line1[i, 0].Split(fullstop);
int len,len1,min;
len1 = word1.Length;
len = word.Length;
if (word.Length > word1.Length)
min=word1.Length;
else
min=word.Length;
j = 0;
while (j < min)
{
if (word[j] != null && word1[j] != null)
{
if (word[j] != word1[j])
{
error = error + " " + word1[j];
}
}
j++;
}
if (word1.Length > word.Length)
{
for (; j < word1.Length; j++)
error = error + " " + word1[j];// prints blah
}
i++;
}
richTextBox3.Text = error;