Please help with code

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.
4 posts Page 1 of 1
Contributors
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Please help with code
muttley1968
Hello I have built this but need to know a way to add a user to the draw I can add them to the list view with all the info but any how it works
For example, let's pretend I have a 10-slot lottery. I would write the entries as follows:

foxilvery 2 #3
supersilver 3 #1
chimmy 4 #3
toby 1 #4

I use an excel function that would basically do this:

foxilvery 3
foxilvery 3
supersilver 1
supersilver 1
supersilver 1
chimmy 3
chimmy 3
chimmy 3
chimmy 3
toby 4

All those numbers combined = 25. So, I would count along that listbox to #25. In this case, Supersilver's last ticket would win. Second place would belong to Toby.
soo how can I do this in code here is my form

Image
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Re: Please help with code
muttley1968
Is no one is able to help can someone atleast point me in the right direction
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

Re: Please help with code
CodenStuff
I'm not clear on what it is you are trying to do and I'm half asleep but I think I get the idea. Would something like this work?
Code: Select all
        Dim Winner = 0
        For i = 0 To 25
            Winner += 1
            If Winner = ListView1.Items.Count - 1 Then
                Winner = 0
            End If
        Next
        Me.Text = ListView1.Items(Winner).Text
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Re: Please help with code
muttley1968
Every time a participant buys tickets, I will write down the participant's name, amount of tickets, and his or her #1-5. This goes on a listview, At the end of the lottery, I will add up all the numbers per ticket. I will use that sum to count along the listbox. The name that number lands on is the first-place winner. For second place, I count along the list using that number again, starting where I left off for the first-place winner.

For example, let's pretend I have a 10-slot lottery. I would write the entries as follows:

foxilvery 2 #3
supersilver 3 #1
chimmy 4 #3
toby 1 #4

soo the listbox I want to make look something like this

foxilvery 3
foxilvery 3
supersilver 1
supersilver 1
supersilver 1
chimmy 3
chimmy 3
chimmy 3
chimmy 3
toby 4

All those numbers combined = 25. So, I would count along that listbox to #25. In this case, Supersilver's last ticket would win.
Hope that makes sense and that someone can help with code to do this :(
4 posts Page 1 of 1
Return to “Coding Help & Support”