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
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.
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?