02-11-16, 11:49 PM
كيف يمكن إزالة عدد من العناصر من listview
مثال عندى listview يوجد بها بعد من العناصر و عندى مجموعة من العناصر
هذه العناصر متغيره اريد اذالتها هذه العناصر من listview ثم اضافة العناصر الجديدة
المشكة ان لا يتم الاضافة او يتم الاضافة بعض الاحيان لاكن اول item فقط
مثال عندى listview يوجد بها بعد من العناصر و عندى مجموعة من العناصر
كود :
Dim Names As String()
Dim id As String()
Dim nameandid As New Dictionary(Of UInt32, String)
كود :
Try
Dim Names As String()
Dim id As String()
Dim nameandid As New Dictionary(Of UInt32, String)
'remove old
For Each Itemre In Names
If Not Itemre = String.Empty Then
ListView1.Items.RemoveAt(Itemre)
nameandid.Remove(nameandid(Itemre))
End If
Next
'change text
Names = {"vb4arb", "ssssss"}
id = {"1231", "789542"}
'add new
For Each Item In Names
ListView1.Items.Add(Item).SubItems.Add(nameandid(ListView1.Items.Count - 1))
nameandid.Add(nameandid(Item.Count - 1), Item)
Next
Catch ex As Exception
End Try
المشكة ان لا يتم الاضافة او يتم الاضافة بعض الاحيان لاكن اول item فقط