Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Compare item to SubItems 2 different listview

Hello thank you in advance for your help, say my columns contains the ListView1
| Title | length | Artist | album | year |

and that contains listview2
| Album | length | weight | Directory. |

I would compare the name of the album and find the ListView1
listview2 album and then recover the weight.
Thanks for your help.
PHP Code

<?php 
For Each item As ListViewItem In ListView1.Items
            
For Each item2 As ListViewItem In ListView1.Items
                
If item.SubItems(3).Text = item2.Text Then MessageBox.Show("Same")
            
Next
        Next 
If this is what you want?
(Feb 3, 2016 10:06 AM)Nikola Тesla Wrote:  
PHP Code

<?php 
For Each item As ListViewItem In ListView1.Items
            
For Each item2 As ListViewItem In ListView1.Items
                
If item.SubItems(3).Text = item2.Text Then MessageBox.Show("Same")
            
Next
        Next 
If this is what you want?

You'll want to exit the loop blocks to conclude the search, unless you're searching for >1 match, in which case break only from the nested loop.
(Feb 3, 2016 11:49 AM)Odus Wrote:  You'll want to exit the loop blocks to conclude the search, unless you're searching for >1 match, in which case break only from the nested loop.

Yes i will end loop if result is found , but that depends on user how much name he wants to compare

PHP Code

<?php 
For Each item As ListViewItem In ListView1.Items
     
For Each item2 As ListViewItem In ListView2.Items
         
If item.SubItems(3).Text = item2.Text Then MessageBox.Show("Same") : Exit For
     
Next
  Next 
thank you very much bro is resolved


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by gigajewNov 26, 2018 05:51 AM 1 247 Nov 26, 2018 05:51 AM
Last Post: Nick (Name)
[C] by F.A.S.TNov 2, 2018 03:35 PM 1 147 Nov 2, 2018 03:35 PM
Last Post: Auriana
[Python] by HydraJun 2, 2018 08:26 PM 2 110 Jun 2, 2018 08:26 PM
Last Post: Hydra