14-07-17, 03:50 AM
جرب بهذه الطريقة
كود البحث
حلقة الدوران مع الشرط
كود البحث
PHP كود :
Private Function FindItem(ItemList As ListView.ListViewItemCollection, ColumnIndex As Integer, SearchString As String) As Dictionary(Of Integer, Boolean)
For Each Item As ListViewItem In ItemList
If Item.SubItems(ColumnIndex).Text = SearchString Then
Return New Dictionary(Of Integer, Boolean) From {{Item.Index, True}}
End If
Next
Return New Dictionary(Of Integer, Boolean) From {{0, False}}
End Function
حلقة الدوران مع الشرط
PHP كود :
For Each itm As ListViewItem In listView1.Items
If Not String.IsNullOrEmpty(itm.SubItems(1).Text) Then
Dim Found As Dictionary(Of Integer, Boolean) = FindItem(ListView2.Items, 0, itm.SubItems(1).Text)
If Found.ContainsValue(True) Then
itm.SubItems(5).Text = "No"
'رقم الاندكس تحصل عليه هنا
'Found.Keys.ElementAt(0)
Else
itm.SubItems(3).Text = ""
itm.SubItems(4).Text = ""
itm.SubItems(5).Text = "Yes"
itm.BackColor = Color.DarkSlateBlue
itm.ForeColor = Color.DarkRed
End If
End If
Next
اللهم لك الحمد كما ينبغي لجلال وجهك و عظيم سلطانك
في حل و ترحال


