|
-
Feb 15th, 2009, 05:30 PM
#1
Thread Starter
New Member
How to simulate voting vb.net ?
i want to users to be able to vote for their favourite soft drink. They will input the names of the soft drinks through the use of an inputbox, the names input are stored in an array.
what i would like to do is count the votes given to each soft drink. How would this be done, please provide example code if possible. thanks
p.s. i tried using a listbox and failed.
Well during the set up of the program they will input the names of all soft drinks up for voting, and then all the soft drinks input wll be displayed in a list when the voting take place.
It is not a homework
Last edited by asif786; Feb 15th, 2009 at 06:20 PM.
-
Feb 15th, 2009, 05:33 PM
#2
Re: How to simulate voting vb.net ?
It kind of sounds like homework, but heres a nudge in the right direction.
I'd use a Dictionary(Of String, Integer). When the user enters the name of a soft drink, you should check if a key exists with that name, and increment its value by 1 if it does. If it does not exist, add it to the dictionary with a value of 1.
-
Feb 15th, 2009, 05:34 PM
#3
Re: How to simulate voting vb.net ?
So do you give a list and then people click on their favorite?, or do they type in the name of their favorite?
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
|