i want to store multiple values in an array. lets say the variable name is voternumber which is a unique number that is generated which is between 1 and 5000. i will output the voternumber to a voter and then as them to input it so that i can perform a check to see wether it has been used before or not. To do this i will need to store all the unique voter numbers, i do not know how to do this i know of arrays but dont know how to add to them b clicking buttons.

Please help and elaborate by giving an example. thanks a lot. if not using arrays could you please explain any other method.

- List or ArrayList can be used for better reasons. and It contains .Contains method which to be used in your case.
- Use Random class to generate numbers but check if the generated number is has been generated before or not.

Dim numbers As List(Of Int32)
while(numbers.Count > 100)
{
if Not numbers.Contains(GetRandomNumber()) 
numbers.Add(GetRandomNumber())
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.