|
Удалить повторящиеся элементы |
|
|
Расположите на форме элемент CommandButton и элемент ListBox. Private Declare Function SendMessageByString Lib
"user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long,
ByVal wParam As Long, ByVal sParam As String) As Long
Const LB_FINDSTRINGEXACT = &H1A2
Private Sub Command1_Click()
For x = 0 To List1.ListCount - 1
For y = 0 To List1.ListCount - 1
ListPos = SendMessageByString(List1.hWnd, LB_FINDSTRINGEXACT, 0, List1.List(x))
If ListPos <> x And ListPos <> -1 Then List1.RemoveItem ListPos
Next y
Next x
End Sub
Private Sub Form_Load()
List1.AddItem "2"
List1.AddItem "2"
List1.AddItem "3"
List1.AddItem "1"
List1.AddItem "4"
List1.AddItem "5"
List1.AddItem "1"
End Sub
|
|
|
|
|
|
|