|
-
Nov 19th, 2000, 01:57 PM
#1
Thread Starter
Lively Member
how can i merge two lists into one, this is the main question.
these two listboxes contain, three items: Name, Phone, Address.
Now how can they both be merged???
-
Nov 19th, 2000, 02:00 PM
#2
The picture isn't missing
do you mean like list1 items on top of list2 items?
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Nov 19th, 2000, 02:20 PM
#3
Thread Starter
Lively Member
no i mean it merges the two of them into one so that if one lising exists in the other list the merged list would only contain one of those listings. Meaning if one Name, Phone, Address is in list #1 and in list #2 then when i merge the merge list will only have one Name, Phone, Address and not the same thing twice.
-
Nov 19th, 2000, 02:32 PM
#4
transcendental analytic
I guess you need something like this:
Code:
For x = 0 To List1.ListCount
For y = 0 To List2.ListCount - 1
If List1.List(x) Like List2.List(y) Then Exit For
Next y
If y = List2.ListCount Then List2.AddItem List1.List(x)
Next x
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 19th, 2000, 02:50 PM
#5
Thread Starter
Lively Member
i have tried the above method but it doesn't seem to work, please advise an other way. remember its like putting the two lists together, and taking out duplicate items
-
Nov 19th, 2000, 03:38 PM
#6
transcendental analytic
The code should work, but depends how you want the result to be. It goes trough each item in list1 and compares it with all items in list2, and refueses to add it whenever it founds a match.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 19th, 2000, 03:41 PM
#7
Thread Starter
Lively Member
it only adds the items from the first list to the lstmerged it doesn't add any of the items from the second list
-
Nov 19th, 2000, 04:45 PM
#8
transcendental analytic
Well why didn't you say so?
Code:
For y = 0 To List2.ListCount - 1
lstmerged.AddItem List2.List(y)
Next y
For x = 0 To List1.ListCount
For y = 0 To List2.ListCount - 1
If List1.List(x) Like List2.List(y) Then Exit For
Next y
If y = List2.ListCount Then lstmerged.AddItem List1.List(x)
Next x
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
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
|