|
-
Dec 9th, 2009, 04:27 PM
#1
Thread Starter
New Member
Adding Items From a List, Removing Items and randomly pairing two items from the list
Hi, I'm just getting into learning VB6. I have a slew of books and search the web, but still find it hard to find exactly what I'm looking for. I don't know if I just don't know exactly what I'm looking for is called or what, but I have finally decided to try and just post a specific question and see what I get.
This is just a project I'm working on to try and learn how to do something in VB. I find that I learn best if I have an objective and try to complete it and see how it all functions together to give me the results I wanted. What I'm trying to make is a program that will pair up names, but will not allow certain names to be paired together.
I'll first describe in general what I'm trying to do and then I'll go into more specific details.
So for the general description:
I want to create a list of names that can vary up to around 10 names or so.
I then want to prompt the user for each name which other name it should not be paired up with (if any). Of course the original name would not be paired up with itself, but also if there is any other name that it should not be paired up with. It will do that for each name and then will randomly pair up each name with another.
For example:
If the list of names is:
John
Max
Sam
Peter
Sara
Jane
Julie
Maria
And I don't want:
John to be paired with Sara
Max to be paired with Jane
Sam to be paired with Julie
Peter to be paired with Maria
After randomly selecting it could come up with something like:
John - Max
Max - Maria
Sam - Peter
Peter- Jane
Sara - Julie
Jane - John
Julie - Sara
Maria - Sam
So as you can see, I want to pair each name with another name, but the two names which should not be paired will never be paired together.
John can be paired with Max and then Max should be taken out of the list so that no other name can pair with him. But Max will still need to be paired with a name as well. It basically takes two lists of the same names and matches them up so that they're not paired with their own name and not paired with a name that was chosen for them not to pair with.
What I have so far is a Main Form.
At that form it has a command button to add names. When the command button is selected a new form appears and has a Text Box to enter a name and a command button to submit the name. It also has a nother command button to stop entering names.
If the submit button is clicked it will add the information from the Text field into a List on the first form and then another form just like it will appear requesting the second name. And so on and so on. Once 10 names have been reached or the user selects the "Stop entering names" button, it will go back to the main form.
Then on the main form there is a Command Button labeled Rules. If they click that button, it will bring up a form that says "Who should Sara (or whoever was the first name entered) not be paired with? Then there are radio buttons with all of the other names from the list except Sara.
This is pretty much where I'm at right now.
I'm stuck with what to do with the radio button. When a certain button is clicked I don't know how to remove that name from the list and then generate a new list for the next name that will remove the name that was just selected before as well as any other names.
Currently the Rules forms (to omit certain names from being paired) is pulling the name from the forms where the names were originally listed (not from the list). I didn't know how to select a name from the list once it's in there.
Any help would be greatly appreciated. Sample files would be great.
Last edited by Blain1976; Dec 9th, 2009 at 04:33 PM.
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
|