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
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
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