Hi, I have array1 and array2.
I need to compare this two array. The number in array1 which is same in array2, it would not come out any output.
If the number in array1 is different with the number in array2, then it will show out the number.
Now my problem is it just will compare the 1st number in the array1 only and cant compare the second number .
is that my for loop got problem?
My coding are shown below.
Hope someone can help me .
try
{
String[] myArray = new string[richTextBox1.Lines.Length];
int i = 0;
foreach (string doub in sortList.Keys)
{
myArray = doub;
i++;
}
String[] myArray1 = new string[richTextBox2.Lines.Length];
int j = 0;
foreach (string doub1 in sortList1.Keys)
{
myArray1[j] = doub1;
j++;
}
String[] array1 = new string[richTextBox4.Lines.Length];
String[] array2 = new string[richTextBox5.Lines.Length];
String array3 = "";
for (int k = 0; k < myArray.Length; k++)
{
array1[k] = myArray[k];
}
for (int n = 0; n < myArray1.Length; n++)
{
array2[n] = myArray1[n];
}
for (int k = 0; k < array1.Length; k++)
{
for (int n = 0; n < array2.Length; n++)
{
if (!array1[k].Contains(array2[n]))
{
array3 += array1[k] + ":" + array2[n] + " \n ";
}
else
{
}
richTextBox3.AppendText(array3);
}
}
}
catch(Exception)
{
MessageBox.Show("Please Click Again!");
}
}