I took up Visual Basic 6 as a hobby for my retirement. I have no formal traning in computer programming...taught myself everything I know. So my code may look alien to you but it works up to a point and that is the nature of my problem.

I am writing a lottery program to check for winners and everything works great except the checking for winners part.

1. I randomly generate 30 non- repeating 6 number combinations out a field of 42 numbers into listbox 1 (this works great)

2. I enter 7 numbers out of the same field of 42 numbers into 7 different textboxes...example: 12-15-22-25-26-33-41

3. What I don't know is how to do is check each item in listbox 1that contain some numbers of the search field ( 12-15-22-25-26-33-41) which can be anywhere from 3 to all 7 for a match into listbox 2 Can you help me?
Please reply tp kenshank281@hotmail.com
Thank you!
Kenneth L. Shank

Could not get your exact requirement from your post. plz use the below checklist to be more clear for your req.

1. Please can u give some test values for the values in the ListBox 1 (approx. 10-12 is enough)
2. The numbers in the 7 text boxes.
3. and the Required result from those values.

Could not get your exact requirement from your post. plz use the below checklist to be more clear for your req.

1. Please can u give some test values for the values in the ListBox 1 (approx. 10-12 is enough)
2. The numbers in the 7 text boxes.
3. and the Required result from those values.

Listbox1 combinations
01-03-05-07-10-11
01-03-05-08-09-11
01-04-06-08-09-11
02-03-05-07-10-12
02-03-06-07-09-11
02-03-06-08-09-11
02-03-06-08-09-12
02-04-05-08-09-12
02-04-06-08-09-11
02-04-06-08-10-12

Test numbers in the 7 textboxes (01-03-06-08-09-10-11-12)

what I am trying to do is write a routine that will search listbox 1
line for line amd dump whatever numbers appear in each item that match the test numbers:

example:

02-04-06-08-10-12 - dumped into listbox 2 : 06-08-10-12 (4 match)
the routine should search each line of listbox1 and dump whatever numbers it finds into listbox 2 matched line for line!!

I hope this explains my problem...Like I said I am very new at this and too old to go back to school LOL!

Regards
Kenneth L. Shank

Dear Shaik

I really do appreicate what you have done...It at least gives me a better understanding of the difficulty of what I am trying to do.

Both versions do exactly what they are supposed to do, but I may have not been clear to you on exactly what the output to Listbox 2 is supposed to be...For example:
If the test numbers are: 01-02-03-04-11-12-06; the 06 being the the extra number drawn in the lottery.

Lets say the first item in Listbox 1 is: 02-05-07-09-11-12 then the numbers found in this case should be: 02-11-12 and that should be the only thing showing in listbox 2...just 3 numbers not 6. The reason for this is that I don't have to search through each item in listbox 1 with my eyes to see if I got any numbers right...the program is suppose to find them for me amd put just those numbers in listbox 2.

I hope I have been more precise to you on what the end of each run of the program is suppose to look like....again in this case listbox 2 should look like this........02-11-12 not 01 02-03-04-11-12

Many thanks for your help so far and I hope time permitting you can achieve the desired result for me.
Regards
Kenneth L. Shank.....kenshank281@hotmail.com

Dear Shaik

I wish to commend you on a job well done! Not only did yo solve my problem...you have given me much to think about! I don't completely understand how you arrived at the solution because I am so new at Visual Basic Programming, but your comments will help me very much and I will study the code until I truly understand all the aspects of the program flow and how it produced the desired result!!

I wish you much success and good fortune

Regards,

Kenneth L. Shank

This question has already been answered. Start a new discussion instead.