ListView Contains Help
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
4 posts
Page 1 of 1
Well I have a small lotto game I am making right and I need to see if a listview conatios 7 numbers I have it set up like this a user will buy a ticket and get added like This
Then I click the lotto tab and roll and I want it to then populate the 5 Closest people into the winers section but I can not think for the life of me how to do this
Any help would be most aprechated or even a different way to make tickets I could redo it just want to get it done :P

Then I click the lotto tab and roll and I want it to then populate the 5 Closest people into the winers section but I can not think for the life of me how to do this

Any help would be most aprechated or even a different way to make tickets I could redo it just want to get it done :P
You could use a couple of For loops to check the listview sub items.
The specific code will depend on how the numbers are displayed.
The specific code will depend on how the numbers are displayed.
Okay I could not figure that out so I made a new system that works tottaly different this time on the amount of tickets a user has
so on this one you simply buy say 10 tickets and give me a nmber between 1 and 5 I then add um all the numbers
soo say I had 5 entreis with 10 tickest like this
user 10 tickets 5
user 10 tickets 5
user 10 tickets 5
user 10 tickets 5
I would I would add there name into the listbox 10 time for each of them and then count through it 20 times and the person it lands on is the winner anyway here is my system does anyone have any ideas on how to do it with code :P

so on this one you simply buy say 10 tickets and give me a nmber between 1 and 5 I then add um all the numbers
soo say I had 5 entreis with 10 tickest like this
user 10 tickets 5
user 10 tickets 5
user 10 tickets 5
user 10 tickets 5
I would I would add there name into the listbox 10 time for each of them and then count through it 20 times and the person it lands on is the winner anyway here is my system does anyone have any ideas on how to do it with code :P

You do not have the required permissions to view the files attached to this post.
That is lucky pick, without players - those who enter needing to pick numbers. But if you want to do it like you wanted the first time it is easy...
Do a loop as mandai said, i hope you didn't remove the project
Do a loop as mandai said, i hope you didn't remove the project
Code: Select all
Something like that
For each lvi as listviewitem in listview1.items
dim numberofcorrect as integer = 0
for each sublvi as listviewsubitem in lvi.subitems
for each drawnnumber as listviewsubitem in listviewDRAWN1.items
if drawnnumber.text = sublvi.text then numberofcorrect +=1
next
next
if numberofcorrect = 5 then 'or 6 not sure how many should be drawn correctly
msgbox("We have a winner "+lvi.text)
end if
next
4 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023