HI Guys
i am developing a Tool which will be compared with two
different files but files data should be same.i am using that below
code it's working and displaying the error into textbox.
but i want highlight that missing word into Richtextbox2 which is
displaying in textbox.
Create two string s1,s2 in main class then
private void button1_Click(object sender, System.EventArgs e)
{
s1 = richTextBox1.SelectedText.ToString();
s2 = richTextBox2.SelectedText.ToString();
CheckString(s1, s2);
}
private void CheckString(string s1, string s2)
{
try
{
string[,] line = new string[500, 2];
string[,] line1 = new string[500, 2];
int i = 0;
for (i = 0; i < 500; i++)
{
line[i, 1] = "0";
line1[i, 1] = "0";
}
i = 0;
char[] fullstop = new char[1];
fullstop[0] = ' ';
string[] AllLine = new string[500];
AllLine = s1.Split(fullstop);
string[] AllLine1 = new string[500];
AllLine1 = s2.Split(fullstop);
string error = " ";
while (i<AllLine.Length && i< AllLine1.Length) //(AllLine[i] != ""
&& AllLine1[i] != "")
{
line[i, 0] = AllLine[i];
line1[i, 0] = AllLine1[i];
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] != "" && word1[j] != "")
{
if (word[j] != word1[j])//main comparison is taking place
{
error = error + " ," + word1[j];
}
}
j++;
}
if (word1.Length word.Length)
{
for (; j < word1.Length; j++)
error = error + " ," + word1[j];
}
i++;
}
textBox1.Text=error;
}
catch (Exception ex)
{
MessageBox.Show("ex");
}
plz help me
Twinkle