30-06-14, 04:18 AM
تفضل أخي 

كود :
Dim ItemsToDelete As New List(Of Integer)
Private Sub Deleted()
ItemsToDelete.Clear()
For I As Integer = 0 To ListBox1.Items.Count - 1
For J As Integer = I + 1 To ListBox1.Items.Count - 1
If Not ItemsToDelete.Contains(J) Then
If LCase(ListBox1.Items(I)) = LCase(ListBox1.Items(J)) Then
ItemsToDelete.Add(J)
End If
End If
Next
Next
Dim Count As Integer = 0
For Each I As Integer In ItemsToDelete
ListBox2.Items.Add(ListBox1.Items(I - Count))
'ListBox1.Items.RemoveAt(I - Count)
Count += 1
lblFileName2.Text = "Deleted: " & Count
Next
ListBox1.Invalidate()
End Sub
Private Sub ListBox1_DrawItem(sender As System.Object, e As System.Windows.Forms.DrawItemEventArgs) Handles ListBox1.DrawItem
Dim MyBrush As SolidBrush = SystemBrushes.WindowText
If ItemsToDelete.Contains(e.Index) Then
MyBrush = New SolidBrush(Color.Red)
End If
Dim MyListBox As ListBox = CType(sender, ListBox)
If MyListBox.Items.Count > 0 Then
e.DrawBackground()
e.Graphics.DrawString(MyListBox.Items(e.Index), e.Font, MyBrush, e.Bounds)
e.DrawFocusRectangle()
End If
End Sub