منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : إزالة العناصر من listview
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
كيف يمكن إزالة عدد من العناصر من listview   
مثال عندى listview يوجد بها بعد من العناصر و عندى مجموعة من العناصر 

كود :
Dim Names As String()
Dim id As String()
            Dim nameandid As New Dictionary(Of UInt32, String)
هذه العناصر متغيره اريد اذالتها  هذه العناصر من listview ثم اضافة العناصر الجديدة

كود :
       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 فقط