943,592 Members | Top Members by Rank

Ad:
Dec 5th, 2008
0

Searching text boxes for items to dump into another textbox

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Kennylee is offline Offline
5 posts
since Aug 2007
Dec 6th, 2008
0

Re: Searching text boxes for items to dump into another textbox

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.
Reputation Points: 26
Solved Threads: 40
Posting Whiz
aktharshaik is offline Offline
316 posts
since Aug 2008
Dec 6th, 2008
0

Re: Searching text boxes for items to dump into another textbox

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Kennylee is offline Offline
5 posts
since Aug 2007
Dec 8th, 2008
0

Re: Searching text boxes for items to dump into another textbox

PLZ REFER THE ATTACHED PROJECT. I DON'T KNOW WHETHER I HAVE SATISFIED UR EXACT NEED / NOT.

I AM UPLOADING TWO DIFFERENT STYLES OF SOLUTIONS.

one with normal textboxes and another with an array of text boxes. In my opinion the array logic will be very comfortable.
Attached Files
File Type: zip SEARCH LIST 01.zip (3.2 KB, 26 views)
File Type: zip SEARCH LIST 02.zip (3.1 KB, 21 views)
Last edited by aktharshaik; Dec 8th, 2008 at 3:49 am.
Reputation Points: 26
Solved Threads: 40
Posting Whiz
aktharshaik is offline Offline
316 posts
since Aug 2008
Dec 8th, 2008
0

Re: Searching text boxes for items to dump into another textbox

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Kennylee is offline Offline
5 posts
since Aug 2007
Dec 9th, 2008
0

Re: Searching text boxes for items to dump into another textbox

Check out the following attachment. I have modified it as far and as much as i could understand. Hope this solves ur problem.
Attached Files
File Type: zip SEARCH LIST 03.zip (3.4 KB, 23 views)
Reputation Points: 26
Solved Threads: 40
Posting Whiz
aktharshaik is offline Offline
316 posts
since Aug 2008
Dec 9th, 2008
0

Re: Searching text boxes for items to dump into another textbox

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Kennylee is offline Offline
5 posts
since Aug 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Setup Problem
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Help with displaying random numbers





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC