Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So I have this 2 listview listView1 has 6 columns named a,b,c,d,e,f then listView2 has 2 columns named a,b

so for example. listview2 row 0 column a has "Joshua" and listview1 has "Joshua", "ex","ex"","ex" and so on.

the plan is to check listView1 if there is/are rows that contains listView2 column a values. if there are equal values listView2 column b must show "Incomplete", however if listView2 doesnt contain any value from listView1, listView2 column b must show "Complete".

What I have tried:

I have this code, it is working but no matter how I change and attempt to trap the value I want, it still displays "Incomplete" in listView2 column b.

C#
for(int re = 0; re < listView1.Items.Count; re++)
            {
                Orders frm = new Orders(this);
                l1[re] = listView1.Items[re].SubItems[2].Text;
                for (int er = 0; er < listView2.Items.Count; er++)
                {

                    l2[er] = listView2.Items[er].SubItems[0].Text;
                    if ((l1[re] != l2[er] || listView1.Items.Count == 0) && checking == "noblanked")
                    {
                        listView2.Items[er].SubItems[1].Text = "Complete";
                    }
                    if (l1[re].Contains(l2[er]) || checking == "blanked")
                    {
                        listView2.Items[er].SubItems[1].Text = "Incomplete";
                    }
                    listView2.Items[er].SubItems[1].Text = listView2.Items[er].SubItems[1].Text;
                }
            }
Posted
Updated 11-Sep-17 22:37pm

1 solution

I think your problem is in the last line, disable that and see what happens:
listView2.Items[er].SubItems[1].Text = listView2.Items[er].SubItems[1].Text;
 
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