|
-
Jul 19th, 2005, 03:16 PM
#1
Thread Starter
Hyperactive Member
Duplicates in a ListBox
What's the easiest way to find duplicates in a ListBox and remove them?
-
Jul 19th, 2005, 03:18 PM
#2
Re: Duplicates in a ListBox
I think it will be better to find the diplicated before you enter them in the ListBox.
Where does the ListBox data come from ?
-
Jul 19th, 2005, 03:30 PM
#3
Thread Starter
Hyperactive Member
Re: Duplicates in a ListBox
My program adds items to the listbox from a file that the user can edit.
-
Jul 19th, 2005, 03:47 PM
#4
Re: Duplicates in a ListBox
the fastest way to check before you add is the use of sendmessage
VB Code:
Option Explicit
Private Declare Function SendMessageString Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Const LB_FINDSTRINGEXACT = &H1A2
'------------------------------------------------------
'then part of the sub adding the strings
If SendMessageString(List1.hwnd, LB_FINDSTRINGEXACT, -1, ByVal The_string_to_add) = -1 Then
List1.AddItem The_string_to_add
End If
casey.
-
Jul 19th, 2005, 05:46 PM
#5
Re: Duplicates in a ListBox
...bearing in mind that the search isn't case sensitive 
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Jul 19th, 2005, 06:12 PM
#6
Thread Starter
Hyperactive Member
Re: Duplicates in a ListBox
That's okay all the items are all automatically converted to upper case anyway. Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|