|
-
Jan 10th, 2007, 05:27 PM
#1
Thread Starter
Hyperactive Member
Generating Words Using Two Lists
Ok i have two lists on my form that both have wordlists in them. I want to do two things, using the neatest and quickest code possible.
First
It will go down list 1 using the first word, and go down list 2 using the first word and merge them together and add them to list 3.
So if list1 was
Richard
Stephen
Shane
and list 2 was
Love
Simple
Clever
i would get the following
RichardLove
StephenSimple
ShaneClever
Second
It will go down list 1 using the first word, and go down list 2 using all the words and merge them together and add them to list 3.
So if list1 was
Richard
Stephen
Shane
and list 2 was
Love
Simple
Clever
i would get the following
RichardLove
RichardSimple
RichardClever
StephenLove
StephenSimple
StephenClever
ShaneLove
ShaneSimple
ShaneClever
Hope this is clear and all help appreciated.
Regards
-
Jan 10th, 2007, 05:40 PM
#2
Member
Re: Generating Words Using Two Lists
This will make list3 like your FIRST example, and list4 like your SECOND example..
VB Code:
Dim I As Integer
Dim J As Integer
For I = 0 To List1.ListCount - 1
If (List2.ListCount > I) Then list3.AddItem List1.List(I) & List2.List(I)
For J = 0 To List2.ListCount - 1
list4.AddItem List1.List(I) & List2.List(J)
Next J
Next I
-
Jan 10th, 2007, 09:28 PM
#3
Re: Generating Words Using Two Lists
Here is a link on how to create a cartesian join of the lists, or list all possible combinations.
http://www.vbforums.com/showthread.p...73#post2706273
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
|