943,817 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 588
  • VB.NET RSS
Jan 3rd, 2009
0

vb dot net arrays

Expand Post »
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.
Last edited by asif786; Jan 3rd, 2009 at 12:15 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
asif786 is offline Offline
19 posts
since Dec 2008
Jan 3rd, 2009
0

Re: vb dot net arrays

- 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.
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006
Jan 3rd, 2009
0

Re: vb dot net arrays

vb.net Syntax (Toggle Plain Text)
  1. Dim numbers As List(Of Int32)
  2. while(numbers.Count > 100)
  3. {
  4. if Not numbers.Contains(GetRandomNumber())
  5. numbers.Add(GetRandomNumber())
  6. }
Last edited by Ramy Mahrous; Jan 3rd, 2009 at 3:26 pm. Reason: I wrote C# code instead of VB.NET!
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Using the table adapter in vb.net 2008
Next Thread in VB.NET Forum Timeline: What ListBox properties do I set to...





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC